Loading sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4 +94 −93 Original line number Diff line number Diff line Loading @@ -47,53 +47,127 @@ truncateTable : TRUNCATE TABLE? ONLY? tableNameParts ; alterIndexName : ALTER INDEX (IF EXISTS)? indexName temporaryClause_ : ((GLOBAL | LOCAL)? (TEMPORARY | TEMP) | UNLOGGED)? ; renameIndexSpecification : RENAME TO indexName existClause_ : (IF NOT EXISTS)? ; alterIndexDependsOnExtension : ALTER INDEX indexName DEPENDS ON EXTENSION ignoredIdentifier_ createDefinitions : LP_ (createDefinition (COMMA_ createDefinition)*)? RP_ ; alterIndexSetTableSpace : ALTER INDEX ALL IN TABLESPACE indexName (OWNED BY ignoredIdentifiers_)? createDefinition : columnDefinition | tableConstraint | LIKE tableName likeOption* ; tableNameParts : tableNamePart (COMMA_ tableNamePart)* columnDefinition : columnName dataType collateClause? columnConstraint* ; tableNamePart : tableName ASTERISK_? columnConstraint : constraintClause? columnConstraintOption constraintOptionalParam ; temporaryClause_ : ((GLOBAL | LOCAL)? (TEMPORARY | TEMP) | UNLOGGED)? constraintClause : CONSTRAINT ignoredIdentifier_ ; existClause_ : (IF NOT EXISTS)? columnConstraintOption : NOT? NULL | checkOption | DEFAULT defaultExpr | GENERATED (ALWAYS | BY DEFAULT) AS IDENTITY (LP_ sequenceOptions RP_)? | UNIQUE indexParameters | primaryKey indexParameters | REFERENCES tableName columnNames? (MATCH FULL | MATCH PARTIAL | MATCH SIMPLE)? (ON (DELETE | UPDATE) action)* ; createDefinitions : LP_ (createDefinition (COMMA_ createDefinition)*)? RP_ checkOption : CHECK expr (NO INHERIT)? ; createDefinition : columnDefinition | tableConstraint | LIKE tableName likeOption* defaultExpr : CURRENT_TIMESTAMP | expr ; sequenceOptions : sequenceOption+ ; sequenceOption : START WITH? NUMBER_ | INCREMENT BY? NUMBER_ | MAXVALUE NUMBER_ | NO MAXVALUE | MINVALUE NUMBER_ | NO MINVALUE | CYCLE | NO CYCLE | CACHE NUMBER_ | OWNED BY ; indexParameters : (USING INDEX TABLESPACE ignoredIdentifier_)? | INCLUDE columnNames | WITH ; action : NO ACTION | RESTRICT | CASCADE | SET (NULL | DEFAULT) ; constraintOptionalParam : (NOT? DEFERRABLE)? (INITIALLY (DEFERRED | IMMEDIATE))? ; likeOption : (INCLUDING | EXCLUDING) (COMMENTS | CONSTRAINTS | DEFAULTS | IDENTITY | INDEXES | STATISTICS | STORAGE | ALL) ; tableConstraint : constraintClause? tableConstraintOption constraintOptionalParam ; tableConstraintOption : checkOption | UNIQUE columnNames indexParameters | primaryKey columnNames indexParameters | EXCLUDE (USING ignoredIdentifier_)? | FOREIGN KEY columnNames REFERENCES tableName columnNames? (MATCH FULL | MATCH PARTIAL | MATCH SIMPLE)? (ON (DELETE | UPDATE) action)* ; inheritClause : INHERITS tableNames ; alterIndexName : ALTER INDEX (IF EXISTS)? indexName ; renameIndexSpecification : RENAME TO indexName ; alterIndexDependsOnExtension : ALTER INDEX indexName DEPENDS ON EXTENSION ignoredIdentifier_ ; alterIndexSetTableSpace : ALTER INDEX ALL IN TABLESPACE indexName (OWNED BY ignoredIdentifiers_)? ; tableNameParts : tableNamePart (COMMA_ tableNamePart)* ; tableNamePart : tableName ASTERISK_? ; alterTableNameWithAsterisk : ALTER TABLE (IF EXISTS)? ONLY? tableName ASTERISK_? ; Loading Loading @@ -208,79 +282,6 @@ usingIndexType : USING (BTREE | HASH | GIST | SPGIST | GIN | BRIN) ; tableConstraint : constraintClause? tableConstraintOption constraintOptionalParam ; columnDefinition : columnName dataType collateClause? columnConstraint* ; columnConstraint : constraintClause? columnConstraintOption constraintOptionalParam ; constraintClause : CONSTRAINT ignoredIdentifier_ ; columnConstraintOption : NOT? NULL | checkOption | DEFAULT defaultExpr | GENERATED (ALWAYS | BY DEFAULT) AS IDENTITY (LP_ sequenceOptions RP_)? | UNIQUE indexParameters | primaryKey indexParameters | REFERENCES tableName columnNames? (MATCH FULL | MATCH PARTIAL | MATCH SIMPLE)? (ON (DELETE | UPDATE) action)* ; checkOption : CHECK expr (NO INHERIT)? ; defaultExpr : CURRENT_TIMESTAMP | expr ; sequenceOptions : sequenceOption+ ; sequenceOption : START WITH? NUMBER_ | INCREMENT BY? NUMBER_ | MAXVALUE NUMBER_ | NO MAXVALUE | MINVALUE NUMBER_ | NO MINVALUE | CYCLE | NO CYCLE | CACHE NUMBER_ | OWNED BY ; indexParameters : (USING INDEX TABLESPACE ignoredIdentifier_)? | INCLUDE columnNames | WITH ; action : NO ACTION | RESTRICT | CASCADE | SET (NULL | DEFAULT) ; constraintOptionalParam : (NOT? DEFERRABLE)? (INITIALLY (DEFERRED | IMMEDIATE))? ; tableConstraintOption : checkOption | UNIQUE columnNames indexParameters | primaryKey columnNames indexParameters | EXCLUDE (USING ignoredIdentifier_)? | FOREIGN KEY columnNames REFERENCES tableName columnNames? (MATCH FULL | MATCH PARTIAL | MATCH SIMPLE)? (ON (DELETE | UPDATE) action)* ; excludeElement : (columnName | expr) ignoredIdentifier_? (ASC | DESC)? (NULLS (FIRST | LAST))? ; Loading
sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4 +94 −93 Original line number Diff line number Diff line Loading @@ -47,53 +47,127 @@ truncateTable : TRUNCATE TABLE? ONLY? tableNameParts ; alterIndexName : ALTER INDEX (IF EXISTS)? indexName temporaryClause_ : ((GLOBAL | LOCAL)? (TEMPORARY | TEMP) | UNLOGGED)? ; renameIndexSpecification : RENAME TO indexName existClause_ : (IF NOT EXISTS)? ; alterIndexDependsOnExtension : ALTER INDEX indexName DEPENDS ON EXTENSION ignoredIdentifier_ createDefinitions : LP_ (createDefinition (COMMA_ createDefinition)*)? RP_ ; alterIndexSetTableSpace : ALTER INDEX ALL IN TABLESPACE indexName (OWNED BY ignoredIdentifiers_)? createDefinition : columnDefinition | tableConstraint | LIKE tableName likeOption* ; tableNameParts : tableNamePart (COMMA_ tableNamePart)* columnDefinition : columnName dataType collateClause? columnConstraint* ; tableNamePart : tableName ASTERISK_? columnConstraint : constraintClause? columnConstraintOption constraintOptionalParam ; temporaryClause_ : ((GLOBAL | LOCAL)? (TEMPORARY | TEMP) | UNLOGGED)? constraintClause : CONSTRAINT ignoredIdentifier_ ; existClause_ : (IF NOT EXISTS)? columnConstraintOption : NOT? NULL | checkOption | DEFAULT defaultExpr | GENERATED (ALWAYS | BY DEFAULT) AS IDENTITY (LP_ sequenceOptions RP_)? | UNIQUE indexParameters | primaryKey indexParameters | REFERENCES tableName columnNames? (MATCH FULL | MATCH PARTIAL | MATCH SIMPLE)? (ON (DELETE | UPDATE) action)* ; createDefinitions : LP_ (createDefinition (COMMA_ createDefinition)*)? RP_ checkOption : CHECK expr (NO INHERIT)? ; createDefinition : columnDefinition | tableConstraint | LIKE tableName likeOption* defaultExpr : CURRENT_TIMESTAMP | expr ; sequenceOptions : sequenceOption+ ; sequenceOption : START WITH? NUMBER_ | INCREMENT BY? NUMBER_ | MAXVALUE NUMBER_ | NO MAXVALUE | MINVALUE NUMBER_ | NO MINVALUE | CYCLE | NO CYCLE | CACHE NUMBER_ | OWNED BY ; indexParameters : (USING INDEX TABLESPACE ignoredIdentifier_)? | INCLUDE columnNames | WITH ; action : NO ACTION | RESTRICT | CASCADE | SET (NULL | DEFAULT) ; constraintOptionalParam : (NOT? DEFERRABLE)? (INITIALLY (DEFERRED | IMMEDIATE))? ; likeOption : (INCLUDING | EXCLUDING) (COMMENTS | CONSTRAINTS | DEFAULTS | IDENTITY | INDEXES | STATISTICS | STORAGE | ALL) ; tableConstraint : constraintClause? tableConstraintOption constraintOptionalParam ; tableConstraintOption : checkOption | UNIQUE columnNames indexParameters | primaryKey columnNames indexParameters | EXCLUDE (USING ignoredIdentifier_)? | FOREIGN KEY columnNames REFERENCES tableName columnNames? (MATCH FULL | MATCH PARTIAL | MATCH SIMPLE)? (ON (DELETE | UPDATE) action)* ; inheritClause : INHERITS tableNames ; alterIndexName : ALTER INDEX (IF EXISTS)? indexName ; renameIndexSpecification : RENAME TO indexName ; alterIndexDependsOnExtension : ALTER INDEX indexName DEPENDS ON EXTENSION ignoredIdentifier_ ; alterIndexSetTableSpace : ALTER INDEX ALL IN TABLESPACE indexName (OWNED BY ignoredIdentifiers_)? ; tableNameParts : tableNamePart (COMMA_ tableNamePart)* ; tableNamePart : tableName ASTERISK_? ; alterTableNameWithAsterisk : ALTER TABLE (IF EXISTS)? ONLY? tableName ASTERISK_? ; Loading Loading @@ -208,79 +282,6 @@ usingIndexType : USING (BTREE | HASH | GIST | SPGIST | GIN | BRIN) ; tableConstraint : constraintClause? tableConstraintOption constraintOptionalParam ; columnDefinition : columnName dataType collateClause? columnConstraint* ; columnConstraint : constraintClause? columnConstraintOption constraintOptionalParam ; constraintClause : CONSTRAINT ignoredIdentifier_ ; columnConstraintOption : NOT? NULL | checkOption | DEFAULT defaultExpr | GENERATED (ALWAYS | BY DEFAULT) AS IDENTITY (LP_ sequenceOptions RP_)? | UNIQUE indexParameters | primaryKey indexParameters | REFERENCES tableName columnNames? (MATCH FULL | MATCH PARTIAL | MATCH SIMPLE)? (ON (DELETE | UPDATE) action)* ; checkOption : CHECK expr (NO INHERIT)? ; defaultExpr : CURRENT_TIMESTAMP | expr ; sequenceOptions : sequenceOption+ ; sequenceOption : START WITH? NUMBER_ | INCREMENT BY? NUMBER_ | MAXVALUE NUMBER_ | NO MAXVALUE | MINVALUE NUMBER_ | NO MINVALUE | CYCLE | NO CYCLE | CACHE NUMBER_ | OWNED BY ; indexParameters : (USING INDEX TABLESPACE ignoredIdentifier_)? | INCLUDE columnNames | WITH ; action : NO ACTION | RESTRICT | CASCADE | SET (NULL | DEFAULT) ; constraintOptionalParam : (NOT? DEFERRABLE)? (INITIALLY (DEFERRED | IMMEDIATE))? ; tableConstraintOption : checkOption | UNIQUE columnNames indexParameters | primaryKey columnNames indexParameters | EXCLUDE (USING ignoredIdentifier_)? | FOREIGN KEY columnNames REFERENCES tableName columnNames? (MATCH FULL | MATCH PARTIAL | MATCH SIMPLE)? (ON (DELETE | UPDATE) action)* ; excludeElement : (columnName | expr) ignoredIdentifier_? (ASC | DESC)? (NULLS (FIRST | LAST))? ;