You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/08/10 13:00:10 UTC
[GitHub] [shardingsphere] happybyr opened a new pull request #6769: PostgreSQL DDL
happybyr opened a new pull request #6769:
URL: https://github.com/apache/shardingsphere/pull/6769
Fixes #ISSUSE_ID.
Changes proposed in this pull request:
-complete and write part of the DDL .g4 in PostgreSQL
-fix the problem in last PR
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] coveralls edited a comment on pull request #6769: PostgreSQL DDL
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #6769:
URL: https://github.com/apache/shardingsphere/pull/6769#issuecomment-675218856
## Pull Request Test Coverage Report for [Build 13686](https://coveralls.io/builds/32671908)
* **0** of **1** **(0.0%)** changed or added relevant line in **1** file are covered.
* **143** unchanged lines in **5** files lost coverage.
* Overall coverage decreased (**-0.03%**) to **56.996%**
---
| Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
| :-----|--------------|--------|---: |
| [shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/impl/PostgreSQLDDLVisitor.java](https://coveralls.io/builds/32671908/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-dialect%2Fshardingsphere-sql-parser-postgresql%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fpostgresql%2Fvisitor%2Fimpl%2FPostgreSQLDDLVisitor.java#L246) | 0 | 1 | 0.0%
<!-- | **Total:** | **0** | **1** | **0.0%** | -->
| Files with Coverage Reduction | New Missed Lines | % |
| :-----|--------------|--: |
| [shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-config/src/main/java/org/apache/shardingsphere/orchestration/core/config/listener/SchemaChangedListener.java](https://coveralls.io/builds/32671908/source?filename=shardingsphere-control-panel%2Fshardingsphere-orchestration%2Fshardingsphere-orchestration-core%2Fshardingsphere-orchestration-core-config%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Forchestration%2Fcore%2Fconfig%2Flistener%2FSchemaChangedListener.java#L73) | 5 | 78.72% |
| [shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-config/src/main/java/org/apache/shardingsphere/orchestration/core/config/ConfigCenter.java](https://coveralls.io/builds/32671908/source?filename=shardingsphere-control-panel%2Fshardingsphere-orchestration%2Fshardingsphere-orchestration-core%2Fshardingsphere-orchestration-core-config%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Forchestration%2Fcore%2Fconfig%2FConfigCenter.java#L137) | 12 | 77.57% |
| [shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/orchestration/repository/zookeeper/CuratorZookeeperRepository.java](https://coveralls.io/builds/32671908/source?filename=shardingsphere-control-panel%2Fshardingsphere-orchestration%2Fshardingsphere-orchestration-repository%2Fshardingsphere-orchestration-repository-provider%2Fshardingsphere-orchestration-repository-zookeeper-curator%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Forchestration%2Frepository%2Fzookeeper%2FCuratorZookeeperRepository.java#L98) | 20 | 79.66% |
| [shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/SQLStatementContextFactory.java](https://coveralls.io/builds/32671908/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-binder%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fbinder%2FSQLStatementContextFactory.java#L91) | 25 | 23.53% |
| [shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/impl/MySQLDDLVisitor.java](https://coveralls.io/builds/32671908/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-dialect%2Fshardingsphere-sql-parser-mysql%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fmysql%2Fvisitor%2Fimpl%2FMySQLDDLVisitor.java#L102) | 81 | 0% |
<!-- | **Total:** | **143** | | -->
| Totals | [](https://coveralls.io/builds/32671908) |
| :-- | --: |
| Change from base [Build 13672](https://coveralls.io/builds/32668046): | -0.03% |
| Covered Lines: | 12847 |
| Relevant Lines: | 22540 |
---
##### 💛 - [Coveralls](https://coveralls.io)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] coveralls commented on pull request #6769: PostgreSQL DDL
Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #6769:
URL: https://github.com/apache/shardingsphere/pull/6769#issuecomment-675218856
## Pull Request Test Coverage Report for [Build 13679](https://coveralls.io/builds/32670645)
* **0** of **1** **(0.0%)** changed or added relevant line in **1** file are covered.
* **106** unchanged lines in **2** files lost coverage.
* Overall coverage decreased (**-0.01%**) to **57.013%**
---
| Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
| :-----|--------------|--------|---: |
| [shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/impl/PostgreSQLDDLVisitor.java](https://coveralls.io/builds/32670645/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-dialect%2Fshardingsphere-sql-parser-postgresql%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fpostgresql%2Fvisitor%2Fimpl%2FPostgreSQLDDLVisitor.java#L246) | 0 | 1 | 0.0%
<!-- | **Total:** | **0** | **1** | **0.0%** | -->
| Files with Coverage Reduction | New Missed Lines | % |
| :-----|--------------|--: |
| [shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/SQLStatementContextFactory.java](https://coveralls.io/builds/32670645/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-binder%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fbinder%2FSQLStatementContextFactory.java#L91) | 25 | 23.53% |
| [shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/impl/MySQLDDLVisitor.java](https://coveralls.io/builds/32670645/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-dialect%2Fshardingsphere-sql-parser-mysql%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fmysql%2Fvisitor%2Fimpl%2FMySQLDDLVisitor.java#L102) | 81 | 0% |
<!-- | **Total:** | **106** | | -->
| Totals | [](https://coveralls.io/builds/32670645) |
| :-- | --: |
| Change from base [Build 13672](https://coveralls.io/builds/32668046): | -0.01% |
| Covered Lines: | 12849 |
| Relevant Lines: | 22537 |
---
##### 💛 - [Coveralls](https://coveralls.io)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jingshanglu commented on a change in pull request #6769: PostgreSQL DDL
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on a change in pull request #6769:
URL: https://github.com/apache/shardingsphere/pull/6769#discussion_r468289768
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/PostgreSQLKeyword.g4
##########
@@ -1380,3 +1380,39 @@ VERBOSE
PARAM
: P A R A M
;
+
+LC_COLLATE
+ : L C UL_ C O L L A T E
+ ;
+
+LC_CTYPE
+ : L C UL_ C T Y P E
+ ;
+
+IS_TEMPLATE
+ : I S UL_ T E M P L A T E
+ ;
+
+ALLOW_CONNECTIONS
+ : A L L O W UL_ C O N N E C T I O N S
+ ;
+
+REPLACCE
+ : R E P L A C C E
+ ;
+
+TMP
+ : T M P
+ ;
+
+TMPORARY
+ : T M P O R A R Y
+ ;
Review comment:
Are this word keyword?
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
##########
@@ -1351,3 +1351,320 @@ ignoredIdentifier_
ignoredIdentifiers_
: ignoredIdentifier_ (COMMA_ ignoredIdentifier_)*
;
+
+signedIconst
+ : NUMBER_
+ | PLUS_ NUMBER_
+ | MINUS_ NUMBER_
+ ;
+
+optBooleanOrString
+ : TRUE
+ | FALSE
+ | ON
+ | nonReservedWord
+ | STRING_
+ ;
+
+nonReservedWord
+ : identifier
+ | unreservedWord
+ | colNameKeyword
+ | typeFuncNameKeyword
+ ;
+
+colNameKeyword
+ : BETWEEN
+ | BIGINT
+ | BIT
+ | BOOLEAN
+ | CHAR
+ | CHARACTER
+ | COALESCE
+ | DEC
+ | DECIMAL
+ | EXISTS
+ | EXTRACT
+ | FLOAT
+ | GREATEST
+ | GROUPING
+ | INOUT
+ | INT
+ | INTEGER
+ | INTERVAL
+ | LEAST
+ | NATIONAL
+ | NCHAR
+ | NONE
+ | NULLIF
+ | NUMERIC
+ | OUT
+ | 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
+ ;
+
+databaseName
+ : colId
+ ;
+
+roleSpec
+ : identifier
+ | nonReservedWord
+ | CURRENT_USER
+ | SESSION_USER
+ ;
+
+varName
+ : colId
+ | varName DOT_ colId
+ ;
+
+varList
+ : varValue
+ | varList COMMA_ varValue
+ ;
+
+varValue
+ : identifier
+ ;
+
+zoneValue
+ : STRING_
+ | identifier
+ | INTERVAL STRING_ optInterval
+ | INTERVAL LP_ NUMBER_ RP_ STRING_
+ | numericOnly
+ | DEFAULT
+ | LOCAL
+ ;
+
+numericOnly
+ : NUMBER_
+ | PLUS_ NUMBER_
+ | MINUS_ NUMBER_
+ ;
+
+isoLevel
+ : READ UNCOMMITTED
+ | READ COMMITTED
+ | REPEATABLE READ
+ | SERIALIZABLE
+ ;
+
+columnDef
+ : colId typeName createGenericOptions colQualList
+ ;
+
+colQualList
+ : colConstraint*
+ ;
+
+colConstraint
+ : CONSTRAINT name colConstraintElem
+ | colConstraintElem
+ | constraintAttr
+ | COLLATE anyName
+ ;
+
+constraintAttr
+ : DEFERRABLE
+ | NOT DEFERRABLE
+ | INITIALLY DEFERRED
+ | INITIALLY IMMEDIATE
+ ;
+
+colConstraintElem
+ : NOT NULL
+ | NULL
+ | UNIQUE optDefinition optConsTableSpace
+ | PRIMARY KEY optDefinition optConsTableSpace
+ | CHECK LP_ aExpr RP_ optNoInherit
+ | DEFAULT bExpr
+ | GENERATED generatedWhen AS IDENTITY optParenthesizedSeqOptList
+ | GENERATED generatedWhen AS LP_ aExpr RP_ STORED
+ | REFERENCES qualifiedName optColumnList keyMatch keyActions
+ ;
+
+optParenthesizedSeqOptList
+ : (LP_ seqOptList RP_)?
+ ;
+
+seqOptList
+ : seqOptElem+
+ ;
+
+seqOptElem
+ : AS simpleTypeName
+ | CACHE numericOnly
+ | CYCLE
+ | NO CYCLE
+ | INCREMENT (BY)? numericOnly
+ | MAXVALUE numericOnly
+ | MINVALUE numericOnly
+ | NO MAXVALUE
+ | NO MINVALUE
+ | OWNED BY anyName
+ | SEQUENCE NAME anyName
+ | START (WITH)? numericOnly
+ | RESTART
+ | RESTART (WITH)? numericOnly
+ ;
+
+optColumnList
+ : LP_ columnList RP_
+ ;
+
+columnElem
+ : colId
+ ;
+
+columnList
+ : columnElem
+ | columnList COMMA_ columnElem
+ ;
+
+generatedWhen
+ : ALWAYS
+ | BY DEFAULT
+ ;
+
+optNoInherit
+ : (NO INHERIT)?
+ ;
+
+optConsTableSpace
+ : (USING INDEX TABLESPACE name)?
+ ;
+
+optDefinition
+ : (WITH definition)?
+ ;
Review comment:
Maybe ,it is good like that
```
consTableSpace
: (USING INDEX TABLESPACE name)?
;
definition
: (WITH definition)?
;
xxx
: consTableSpace?
```
The same applies to others.
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/impl/PostgreSQLDDLVisitor.java
##########
@@ -101,7 +102,7 @@ public ASTNode visitCreateDefinitionClause(final CreateDefinitionClauseContext c
}
return result;
}
-
+
Review comment:
Keep the original format,Modify the other lines as well.
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
##########
@@ -17,34 +17,187 @@
grammar DDLStatement;
-import Symbol, Keyword, PostgreSQLKeyword, Literals, BaseRule;
+import Symbol, Keyword, PostgreSQLKeyword, Literals, BaseRule,DMLStatement;
createTable
- : CREATE createTableSpecification_ TABLE tableNotExistClause_ tableName createDefinitionClause inheritClause_
+ : CREATE createTableSpecification_ TABLE tableNotExistClause_ tableName
+ createDefinitionClause
+ (OF anyName optTypedTableElementList)?
+ (PARTITION OF qualifiedName optTypedTableElementList partitionBoundSpec)?
+ inheritClause_ optPartitionSpec_ tableAccessMethodClause optWith onCommitOption optTableSpace
+ (AS select optWithData)?
+ (EXECUTE name executeParamClause optWithData)?
+ ;
+
+executeParamClause
+ : LP_ exprList RP_
+ ;
+
+partitionBoundSpec
+ : FOR VALUES WITH LP_ hashPartbound RP_
+ | FOR VALUES IN LP_ exprList RP_
+ | FOR VALUES FROM LP_ exprList RP_ TO LP_ exprList RP_
+ | DEFAULT
+ ;
+
+hashPartbound
+ : hashPartboundElem
+ | hashPartbound COMMA_ hashPartboundElem
+ ;
+
+hashPartboundElem
+ : nonReservedWord NUMBER_
+ ;
+
+optTypedTableElementList
+ : LP_ typedTableElementList RP_
+ ;
+
+typedTableElementList
+ : typedTableElement
+ | typedTableElementList COMMA_ typedTableElement
+ ;
Review comment:
Maybe, it is good like that
```
typedTableElementList
: typedTableElement*
;
```
it can reduce recursion and looks simple. it is same as others.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jingshanglu commented on a change in pull request #6769: PostgreSQL DDL
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on a change in pull request #6769:
URL: https://github.com/apache/shardingsphere/pull/6769#discussion_r468447840
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
##########
@@ -305,3 +474,514 @@ indexExistClause_
indexNames
: indexName (COMMA_ indexName)*
;
+
+alterDatabase
+ : ALTER DATABASE databaseName alterDatabaseClause
+ ;
+
+alterDatabaseClause
+ : (WITH)? createdbOptItems?
+ | RENAME TO databaseName
+ | OWNER TO roleSpec
+ | SET TABLESPACE name
+ | setResetClause
+ ;
Review comment:
Plz refer to gram.y, maybe the official doc is not correct.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-commenter commented on pull request #6769: PostgreSQL DDL
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #6769:
URL: https://github.com/apache/shardingsphere/pull/6769#issuecomment-671370088
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/6769?src=pr&el=h1) Report
> Merging [#6769](https://codecov.io/gh/apache/shardingsphere/pull/6769?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere/commit/3b057152ae24dbe22099f3fea17acd97280c20b1&el=desc) will **not change** coverage.
> The diff coverage is `0.00%`.
[](https://codecov.io/gh/apache/shardingsphere/pull/6769?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #6769 +/- ##
=========================================
Coverage 54.59% 54.59%
Complexity 428 428
=========================================
Files 1237 1237
Lines 21964 21964
Branches 3950 3950
=========================================
Hits 11992 11992
Misses 9202 9202
Partials 770 770
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/6769?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [.../postgresql/visitor/impl/PostgreSQLDDLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/6769/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1wb3N0Z3Jlc3FsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zcWwvcGFyc2VyL3Bvc3RncmVzcWwvdmlzaXRvci9pbXBsL1Bvc3RncmVTUUxERExWaXNpdG9yLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/6769?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/6769?src=pr&el=footer). Last update [3b05715...bfcedb5](https://codecov.io/gh/apache/shardingsphere/pull/6769?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jingshanglu merged pull request #6769: PostgreSQL DDL
Posted by GitBox <gi...@apache.org>.
jingshanglu merged pull request #6769:
URL: https://github.com/apache/shardingsphere/pull/6769
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jingshanglu commented on a change in pull request #6769: PostgreSQL DDL
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on a change in pull request #6769:
URL: https://github.com/apache/shardingsphere/pull/6769#discussion_r468398586
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
##########
@@ -1351,3 +1333,309 @@ ignoredIdentifier_
ignoredIdentifiers_
: ignoredIdentifier_ (COMMA_ ignoredIdentifier_)*
;
+
+signedIconst
+ : NUMBER_
+ | PLUS_ NUMBER_
+ | MINUS_ NUMBER_
+ ;
+
+optBooleanOrString
+ : TRUE
+ | FALSE
+ | ON
+ | nonReservedWord
+ | STRING_
+ ;
+
+nonReservedWord
+ : identifier
+ | unreservedWord
+ | colNameKeyword
+ | typeFuncNameKeyword
+ ;
+
+colNameKeyword
+ : BETWEEN
+ | BIGINT
+ | BIT
+ | BOOLEAN
+ | CHAR
+ | CHARACTER
+ | COALESCE
+ | DEC
+ | DECIMAL
+ | EXISTS
+ | EXTRACT
+ | FLOAT
+ | GREATEST
+ | GROUPING
+ | INOUT
+ | INT
+ | INTEGER
+ | INTERVAL
+ | LEAST
+ | NATIONAL
+ | NCHAR
+ | NONE
+ | NULLIF
+ | NUMERIC
+ | OUT
+ | 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
+ ;
+
+databaseName
+ : colId
+ ;
+
+roleSpec
+ : identifier
+ | nonReservedWord
+ | CURRENT_USER
+ | SESSION_USER
+ ;
+
+varName
+ : colId
+ | varName DOT_ colId
+ ;
+
+varList
+ : varValue (COMMA_ varValue)*
+ ;
+
+varValue
+ : identifier
+ ;
+
+zoneValue
+ : STRING_
+ | identifier
+ | INTERVAL STRING_ optInterval
+ | INTERVAL LP_ NUMBER_ RP_ STRING_
+ | numericOnly
+ | DEFAULT
+ | LOCAL
+ ;
+
+numericOnly
+ : NUMBER_
+ | PLUS_ NUMBER_
+ | MINUS_ NUMBER_
+ ;
+
+isoLevel
+ : READ UNCOMMITTED
+ | READ COMMITTED
+ | REPEATABLE READ
+ | SERIALIZABLE
+ ;
+
+columnDef
+ : colId typeName createGenericOptions colQualList
+ ;
+
+colQualList
+ : colConstraint*
+ ;
+
+colConstraint
+ : CONSTRAINT name colConstraintElem
+ | colConstraintElem
+ | constraintAttr
+ | COLLATE anyName
+ ;
+
+constraintAttr
+ : DEFERRABLE
+ | NOT DEFERRABLE
+ | INITIALLY DEFERRED
+ | INITIALLY IMMEDIATE
+ ;
+
+colConstraintElem
+ : NOT NULL
+ | NULL
+ | UNIQUE (WITH definition)? consTableSpace
+ | PRIMARY KEY (WITH definition)? consTableSpace
+ | CHECK LP_ aExpr RP_ noInherit?
+ | DEFAULT bExpr
+ | GENERATED generatedWhen AS IDENTITY optParenthesizedSeqOptList
+ | GENERATED generatedWhen AS LP_ aExpr RP_ STORED
+ | REFERENCES qualifiedName optColumnList? keyMatch? keyActions?
+ ;
+
+optParenthesizedSeqOptList
+ : (LP_ seqOptList RP_)?
+ ;
+
+seqOptList
+ : seqOptElem+
+ ;
+
+seqOptElem
+ : AS simpleTypeName
+ | CACHE numericOnly
+ | CYCLE
+ | NO CYCLE
+ | INCREMENT (BY)? numericOnly
+ | MAXVALUE numericOnly
+ | MINVALUE numericOnly
+ | NO MAXVALUE
+ | NO MINVALUE
+ | OWNED BY anyName
+ | SEQUENCE NAME anyName
+ | START (WITH)? numericOnly
+ | RESTART
+ | RESTART (WITH)? numericOnly
+ ;
+
+optColumnList
+ : LP_ columnList RP_
+ ;
+
+columnElem
+ : colId
+ ;
+
+columnList
+ : columnElem (COMMA_ columnElem)*
+ ;
+
+generatedWhen
+ : ALWAYS
+ | BY DEFAULT
+ ;
+
+noInherit
+ : NO INHERIT
+ ;
+
+consTableSpace
+ : USING INDEX TABLESPACE name
+ ;
+
+definition
+ : LP_ defList RP_
+ ;
+
+defList
+ : defElem (COMMA_ defElem)*
+ ;
+
+defElem
+ : colLabel defArg?
+ ;
+
+colLabel
+ : identifier
+ | unreservedWord
+ | colNameKeyword
+ | typeFuncNameKeyword
+ | reservedKeyword
+ ;
+
+keyActions
+ : keyUpdate
+ | keyDelete
+ | keyUpdate keyDelete
+ | keyDelete keyUpdate
+ ;
+
+keyDelete
+ : ON DELETE keyAction
+ ;
+
+keyUpdate
+ : ON UPDATE keyAction
+ ;
+
+keyAction
+ : NO ACTION
+ | RESTRICT
+ | CASCADE
+ | SET NULL
+ | SET DEFAULT
+ ;
Review comment:
Keep the format consistent.
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
##########
@@ -17,34 +17,170 @@
grammar DDLStatement;
-import Symbol, Keyword, PostgreSQLKeyword, Literals, BaseRule;
+import Symbol, Keyword, PostgreSQLKeyword, Literals, BaseRule,DMLStatement;
createTable
- : CREATE createTableSpecification_ TABLE tableNotExistClause_ tableName createDefinitionClause inheritClause_
+ : CREATE createTableSpecification_ TABLE tableNotExistClause_ tableName
+ createDefinitionClause
+ (OF anyName (LP_ typedTableElementList RP_)?)?
+ (PARTITION OF qualifiedName (LP_ typedTableElementList RP_)? partitionBoundSpec)?
+ inheritClause_ partitionSpec? tableAccessMethodClause withOption? onCommitOption? tableSpace?
+ (AS select withData?)?
+ (EXECUTE name executeParamClause withData?)?
+ ;
+
+executeParamClause
+ : LP_ exprList RP_
+ ;
+
+partitionBoundSpec
+ : FOR VALUES WITH LP_ hashPartbound RP_
+ | FOR VALUES IN LP_ exprList RP_
+ | FOR VALUES FROM LP_ exprList RP_ TO LP_ exprList RP_
+ | DEFAULT
+ ;
+
+hashPartbound
+ : hashPartboundElem (COMMA_ hashPartboundElem)*
+ ;
+
+hashPartboundElem
+ : nonReservedWord NUMBER_
+ ;
+
+typedTableElementList
+ : typedTableElement (COMMA_ typedTableElement)*
+ ;
+
+typedTableElement
+ : columnOptions
+ | tableConstraint
+ ;
+
+columnOptions
+ : colId (WITH OPTIONS)? colQualList
+ ;
+
+colQualList
+ : columnConstraint*
+ ;
+
+withData
+ : WITH DATA | WITH NO DATA
+ ;
+
+tableSpace
+ : TABLESPACE name
+ ;
+
+onCommitOption
+ : ON COMMIT (DROP | DELETE ROWS | PRESERVE ROWS)
+ ;
+
+withOption
+ : WITH reloptions | WITHOUT OIDS
+ ;
+
+tableAccessMethodClause
+ : (USING accessMethod)?
+ ;
+
+accessMethod
+ : colId
;
createIndex
- : CREATE createIndexSpecification_ INDEX concurrentlyClause_ (indexNotExistClause_ indexName)? ON onlyClause_ tableName
+ : CREATE createIndexSpecification_ INDEX concurrentlyClause_ (indexNotExistClause_ indexName)? ON onlyClause_ tableName
+ accessMethodClause? LP_ indexParams RP_ include? (WITH reloptions)? tableSpace? whereClause?
+ ;
+
+include
+ : INCLUDE LP_ indexIncludingParams RP_
+ ;
+
+indexIncludingParams
+ : indexElem (COMMA_ indexElem)*
+ ;
+
+accessMethodClause
+ : USING accessMethod
+ ;
+
+createDatabase
+ : CREATE DATABASE name optWith_ createDatabaseSpecification_*
+ ;
+
+createView
+ : CREATE (OR REPLACCE)? (TMP | TMPORARY)? (RECURSIVE)? VIEW name
+ (LP_ (columnList (COMMA_ columnList)*)? RP_)?
+ (WITH reloptions)?
+ AS select
+ (WITH (CASCADE | LOCAL)? CHECK OPTION)?
+ ;
+
+columnList
+ : columnElem (COMMA_ columnElem)*
+ ;
+
+columnElem
+ : colId
+ ;
+
+dropDatabase
+ : DROP DATABASE (IF EXISTS)? name
+ ;
+
+createDatabaseSpecification_
+ : createdbOptName (EQ_)? (signedIconst | optBooleanOrString | DEFAULT)
+ ;
+
+createdbOptName
+ : identifier
+ | CONNECTION LIMIT
+ | ENCODING
+ | LOCATION
+ | OWNER
+ | TABLESPACE
+ | TEMPLATE
+ ;
+
+optWith_
+ : (WITH)?
Review comment:
It can be deleted,use `with` directly.
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/PostgreSQLKeyword.g4
##########
@@ -1380,3 +1380,23 @@ VERBOSE
PARAM
: P A R A M
;
+
+REPLACCE
+ : R E P L A C C E
+ ;
+
+TMP
+ : T M P
+ ;
+
+TMPORARY
+ : T M P O R A R Y
+ ;
Review comment:
Maybe, it should be `TEMPORARY` and `TEMP`.
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/impl/PostgreSQLDDLVisitor.java
##########
@@ -145,7 +146,7 @@ public ASTNode visitAlterDefinitionClause(final AlterDefinitionClauseContext ctx
}
return result;
}
-
+
Review comment:
same as above.
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
##########
@@ -1351,3 +1333,309 @@ ignoredIdentifier_
ignoredIdentifiers_
: ignoredIdentifier_ (COMMA_ ignoredIdentifier_)*
;
+
+signedIconst
+ : NUMBER_
+ | PLUS_ NUMBER_
+ | MINUS_ NUMBER_
+ ;
+
+optBooleanOrString
+ : TRUE
+ | FALSE
+ | ON
+ | nonReservedWord
+ | STRING_
+ ;
+
+nonReservedWord
+ : identifier
+ | unreservedWord
+ | colNameKeyword
+ | typeFuncNameKeyword
+ ;
+
+colNameKeyword
+ : BETWEEN
+ | BIGINT
+ | BIT
+ | BOOLEAN
+ | CHAR
+ | CHARACTER
+ | COALESCE
+ | DEC
+ | DECIMAL
+ | EXISTS
+ | EXTRACT
+ | FLOAT
+ | GREATEST
+ | GROUPING
+ | INOUT
+ | INT
+ | INTEGER
+ | INTERVAL
+ | LEAST
+ | NATIONAL
+ | NCHAR
+ | NONE
+ | NULLIF
+ | NUMERIC
+ | OUT
+ | 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
+ ;
+
+databaseName
+ : colId
+ ;
+
+roleSpec
+ : identifier
+ | nonReservedWord
+ | CURRENT_USER
+ | SESSION_USER
+ ;
+
+varName
+ : colId
+ | varName DOT_ colId
+ ;
+
+varList
+ : varValue (COMMA_ varValue)*
+ ;
+
+varValue
+ : identifier
+ ;
+
+zoneValue
+ : STRING_
+ | identifier
+ | INTERVAL STRING_ optInterval
+ | INTERVAL LP_ NUMBER_ RP_ STRING_
+ | numericOnly
+ | DEFAULT
+ | LOCAL
+ ;
+
+numericOnly
+ : NUMBER_
+ | PLUS_ NUMBER_
+ | MINUS_ NUMBER_
+ ;
+
+isoLevel
+ : READ UNCOMMITTED
+ | READ COMMITTED
+ | REPEATABLE READ
+ | SERIALIZABLE
+ ;
+
+columnDef
+ : colId typeName createGenericOptions colQualList
+ ;
+
+colQualList
+ : colConstraint*
+ ;
+
+colConstraint
+ : CONSTRAINT name colConstraintElem
+ | colConstraintElem
+ | constraintAttr
+ | COLLATE anyName
+ ;
+
+constraintAttr
+ : DEFERRABLE
+ | NOT DEFERRABLE
+ | INITIALLY DEFERRED
+ | INITIALLY IMMEDIATE
+ ;
+
+colConstraintElem
+ : NOT NULL
+ | NULL
+ | UNIQUE (WITH definition)? consTableSpace
+ | PRIMARY KEY (WITH definition)? consTableSpace
+ | CHECK LP_ aExpr RP_ noInherit?
+ | DEFAULT bExpr
+ | GENERATED generatedWhen AS IDENTITY optParenthesizedSeqOptList
+ | GENERATED generatedWhen AS LP_ aExpr RP_ STORED
+ | REFERENCES qualifiedName optColumnList? keyMatch? keyActions?
+ ;
+
+optParenthesizedSeqOptList
+ : (LP_ seqOptList RP_)?
+ ;
Review comment:
Same to above.
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/impl/PostgreSQLDDLVisitor.java
##########
@@ -121,7 +122,7 @@ public ASTNode visitAlterTable(final AlterTableContext ctx) {
}
return result;
}
-
+
Review comment:
keep original format.plz check other lines.
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
##########
@@ -17,34 +17,170 @@
grammar DDLStatement;
-import Symbol, Keyword, PostgreSQLKeyword, Literals, BaseRule;
+import Symbol, Keyword, PostgreSQLKeyword, Literals, BaseRule,DMLStatement;
createTable
- : CREATE createTableSpecification_ TABLE tableNotExistClause_ tableName createDefinitionClause inheritClause_
+ : CREATE createTableSpecification_ TABLE tableNotExistClause_ tableName
+ createDefinitionClause
+ (OF anyName (LP_ typedTableElementList RP_)?)?
+ (PARTITION OF qualifiedName (LP_ typedTableElementList RP_)? partitionBoundSpec)?
+ inheritClause_ partitionSpec? tableAccessMethodClause withOption? onCommitOption? tableSpace?
+ (AS select withData?)?
+ (EXECUTE name executeParamClause withData?)?
+ ;
+
+executeParamClause
+ : LP_ exprList RP_
+ ;
+
+partitionBoundSpec
+ : FOR VALUES WITH LP_ hashPartbound RP_
+ | FOR VALUES IN LP_ exprList RP_
+ | FOR VALUES FROM LP_ exprList RP_ TO LP_ exprList RP_
+ | DEFAULT
+ ;
+
+hashPartbound
+ : hashPartboundElem (COMMA_ hashPartboundElem)*
+ ;
+
+hashPartboundElem
+ : nonReservedWord NUMBER_
+ ;
+
+typedTableElementList
+ : typedTableElement (COMMA_ typedTableElement)*
+ ;
+
+typedTableElement
+ : columnOptions
+ | tableConstraint
+ ;
+
+columnOptions
+ : colId (WITH OPTIONS)? colQualList
+ ;
+
+colQualList
+ : columnConstraint*
+ ;
+
+withData
+ : WITH DATA | WITH NO DATA
+ ;
+
+tableSpace
+ : TABLESPACE name
+ ;
+
+onCommitOption
+ : ON COMMIT (DROP | DELETE ROWS | PRESERVE ROWS)
+ ;
+
+withOption
+ : WITH reloptions | WITHOUT OIDS
+ ;
+
+tableAccessMethodClause
+ : (USING accessMethod)?
+ ;
Review comment:
Same as above.
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
##########
@@ -305,3 +478,519 @@ indexExistClause_
indexNames
: indexName (COMMA_ indexName)*
;
+
+alterDatabase
+ : ALTER DATABASE databaseName alterDatabaseClause
+ ;
+
+alterDatabaseClause
+ : (WITH)? createdbOptItems?
+ | RENAME TO databaseName
+ | OWNER TO roleSpec
+ | SET TABLESPACE name
+ | setResetClause
+ ;
+
+setResetClause
+ : SET setRest
+ | variableResetStmt
+ ;
+
+setRest
+ : TRANSACTION transactionModeList
+ | SESSION CHARACTERISTICS AS TRANSACTION transactionModeList
+ | setRestMore
+ ;
+
+transactionModeList
+ : transactionModeItem ((COMMA_)? transactionModeItem)*
+ ;
+
+transactionModeItem
+ : ISOLATION LEVEL isoLevel
+ | READ ONLY
+ | READ WRITE
+ | DEFERRABLE
+ | NOT DEFERRABLE
+ ;
+
+setRestMore
+ : genericSet
+ | varName FROM CURRENT
+ | TIME ZONE zoneValue
+ | CATALOG STRING_
+ | SCHEMA STRING_
+ | NAMES encoding?
+ | ROLE nonReservedWord | STRING_
+ | SESSION AUTHORIZATION nonReservedWord | STRING_
+ | SESSION AUTHORIZATION DEFAULT
+ | XML OPTION documentOrContent
+ | TRANSACTION SNAPSHOT STRING_
+ ;
+
+encoding
+ : STRING_
+ | DEFAULT
+ ;
+
+genericSet
+ : varName (EQ_|TO) (varList | DEFAULT)
+ ;
+
+documentOrContent
+ : DOCUMENT
+ | CONTENT
+ ;
+
+createdbOptItems
+ : createdbOptItem+
+ ;
+
+createdbOptItem
+ : createdbOptName (EQ_)? signedIconst
+ | createdbOptName (EQ_)? optBooleanOrString
+ | createdbOptName (EQ_)? DEFAULT
+ ;
+
+variableResetStmt
+ : RESET resetRest
+ ;
+
+resetRest
+ : genericReset
+ | TIME ZONE
+ | TRANSACTION ISOLATION LEVEL
+ | SESSION AUTHORIZATION
+ ;
+
+genericReset
+ : varName
+ | ALL
+ ;
+
+alterTableCmds
+ : alterTableCmd (COMMA_ alterTableCmd)*
+ ;
+
+alterTableCmd
+ : ADD COLUMN? (IF NOT EXISTS)? columnDef
+ | ALTER column? colId alterColumnDefault
+ | ALTER column? colId DROP NOT NULL
+ | ALTER column? colId SET NOT NULL
+ | ALTER column? colId SET STATISTICS signedIconst
+ | ALTER column? NUMBER_ SET STATISTICS signedIconst
+ | ALTER column? colId SET reloptions
+ | ALTER column? colId RESET reloptions
+ | ALTER column? colId SET STORAGE colId
+ | ALTER column? colId ADD GENERATED generatedWhen AS IDENTITY optParenthesizedSeqOptList
+ | ALTER column? colId alterIdentityColumnOptionList
+ | ALTER column? colId DROP IDENTITY
+ | ALTER column? colId DROP IDENTITY IF EXISTS
+ | DROP column? IF EXISTS colId dropBehavior?
+ | DROP column? colId dropBehavior?
+ | ALTER column? colId setData? TYPE typeName collateClause? alterUsing?
+ | ALTER column? colId alterGenericOptions
+ | ADD tableConstraint
+ | ALTER CONSTRAINT name constraintAttributeSpec
+ | VALIDATE CONSTRAINT name
+ | DROP CONSTRAINT IF EXISTS name dropBehavior?
+ | DROP CONSTRAINT name dropBehavior?
+ | SET WITHOUT OIDS
+ | CLUSTER ON name
+ | SET WITHOUT CLUSTER
+ | SET LOGGED
+ | SET UNLOGGED
+ | ENABLE TRIGGER name
+ | ENABLE ALWAYS TRIGGER name
+ | ENABLE REPLICA TRIGGER name
+ | ENABLE TRIGGER ALL
+ | ENABLE TRIGGER USER
+ | DISABLE TRIGGER name
+ | DISABLE TRIGGER ALL
+ | DISABLE TRIGGER USER
+ | ENABLE RULE name
+ | ENABLE ALWAYS RULE name
+ | ENABLE REPLICA RULE name
+ | DISABLE RULE name
+ | INHERIT qualifiedName
+ | NO INHERIT qualifiedName
+ | OF anyName
+ | NOT OF
+ | OWNER TO roleSpec
+ | SET TABLESPACE name
+ | SET reloptions
+ | RESET reloptions
+ | REPLICA IDENTITY replicaIdentity
+ | ENABLE ROW LEVEL SECURITY
+ | DISABLE ROW LEVEL SECURITY
+ | FORCE ROW LEVEL SECURITY
+ | NO FORCE ROW LEVEL SECURITY
+ | alterGenericOptions
+ ;
+
+constraintAttributeSpec
+ : constraintAttributeElem*
+ ;
+
+constraintAttributeElem
+ : NOT DEFERRABLE
+ | DEFERRABLE
+ | INITIALLY IMMEDIATE
+ | INITIALLY DEFERRED
+ | NOT VALID
+ | NO INHERIT
+ ;
+
+alterGenericOptions
+ : OPTIONS LP_ alterGenericOptionList RP_
+ ;
+
+alterGenericOptionList
+ : alterGenericOptionElem (COMMA_ alterGenericOptionElem)*
+ ;
+
+alterGenericOptionElem
+ : genericOptionElem
+ | SET genericOptionElem
+ | ADD genericOptionElem
+ | DROP genericOptionName
+ ;
+
+genericOptionName
+ : colLable
+ ;
+
+dropBehavior
+ : CASCADE | RESTRICT
+ ;
+
+alterUsing
+ : USING aExpr
+ ;
+
+setData
+ : SET DATA
+ ;
+
+alterIdentityColumnOptionList
+ : alterIdentityColumnOption+
+ ;
+
+alterIdentityColumnOption
+ : RESTART
+ | RESTART (WITH)? numericOnly
+ | SET seqOptElem
+ | SET GENERATED generatedWhen
+ ;
+
+alterColumnDefault
+ : SET DEFAULT aExpr
+ | DROP DEFAULT
+ ;
+
+column
+ : COLUMN
+ ;
Review comment:
It can be deleted, use `COLUMN` directly.
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
##########
@@ -1351,3 +1333,309 @@ ignoredIdentifier_
ignoredIdentifiers_
: ignoredIdentifier_ (COMMA_ ignoredIdentifier_)*
;
+
+signedIconst
+ : NUMBER_
+ | PLUS_ NUMBER_
+ | MINUS_ NUMBER_
+ ;
+
+optBooleanOrString
+ : TRUE
+ | FALSE
+ | ON
+ | nonReservedWord
+ | STRING_
+ ;
+
+nonReservedWord
+ : identifier
+ | unreservedWord
+ | colNameKeyword
+ | typeFuncNameKeyword
+ ;
+
+colNameKeyword
+ : BETWEEN
+ | BIGINT
+ | BIT
+ | BOOLEAN
+ | CHAR
+ | CHARACTER
+ | COALESCE
+ | DEC
+ | DECIMAL
+ | EXISTS
+ | EXTRACT
+ | FLOAT
+ | GREATEST
+ | GROUPING
+ | INOUT
+ | INT
+ | INTEGER
+ | INTERVAL
+ | LEAST
+ | NATIONAL
+ | NCHAR
+ | NONE
+ | NULLIF
+ | NUMERIC
+ | OUT
+ | 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
+ ;
+
+databaseName
+ : colId
+ ;
+
+roleSpec
+ : identifier
+ | nonReservedWord
+ | CURRENT_USER
+ | SESSION_USER
+ ;
+
+varName
+ : colId
+ | varName DOT_ colId
+ ;
+
+varList
+ : varValue (COMMA_ varValue)*
+ ;
+
+varValue
+ : identifier
+ ;
+
+zoneValue
+ : STRING_
+ | identifier
+ | INTERVAL STRING_ optInterval
+ | INTERVAL LP_ NUMBER_ RP_ STRING_
+ | numericOnly
+ | DEFAULT
+ | LOCAL
+ ;
+
+numericOnly
+ : NUMBER_
+ | PLUS_ NUMBER_
+ | MINUS_ NUMBER_
+ ;
+
+isoLevel
+ : READ UNCOMMITTED
+ | READ COMMITTED
+ | REPEATABLE READ
+ | SERIALIZABLE
+ ;
+
+columnDef
+ : colId typeName createGenericOptions colQualList
+ ;
+
+colQualList
+ : colConstraint*
+ ;
+
+colConstraint
+ : CONSTRAINT name colConstraintElem
+ | colConstraintElem
+ | constraintAttr
+ | COLLATE anyName
+ ;
+
+constraintAttr
+ : DEFERRABLE
+ | NOT DEFERRABLE
+ | INITIALLY DEFERRED
+ | INITIALLY IMMEDIATE
+ ;
+
+colConstraintElem
+ : NOT NULL
+ | NULL
+ | UNIQUE (WITH definition)? consTableSpace
+ | PRIMARY KEY (WITH definition)? consTableSpace
+ | CHECK LP_ aExpr RP_ noInherit?
+ | DEFAULT bExpr
+ | GENERATED generatedWhen AS IDENTITY optParenthesizedSeqOptList
+ | GENERATED generatedWhen AS LP_ aExpr RP_ STORED
+ | REFERENCES qualifiedName optColumnList? keyMatch? keyActions?
+ ;
+
+optParenthesizedSeqOptList
+ : (LP_ seqOptList RP_)?
+ ;
+
+seqOptList
+ : seqOptElem+
+ ;
+
+seqOptElem
+ : AS simpleTypeName
+ | CACHE numericOnly
+ | CYCLE
+ | NO CYCLE
+ | INCREMENT (BY)? numericOnly
+ | MAXVALUE numericOnly
+ | MINVALUE numericOnly
+ | NO MAXVALUE
+ | NO MINVALUE
+ | OWNED BY anyName
+ | SEQUENCE NAME anyName
+ | START (WITH)? numericOnly
+ | RESTART
+ | RESTART (WITH)? numericOnly
+ ;
+
+optColumnList
+ : LP_ columnList RP_
+ ;
+
+columnElem
+ : colId
+ ;
+
+columnList
+ : columnElem (COMMA_ columnElem)*
+ ;
+
+generatedWhen
+ : ALWAYS
+ | BY DEFAULT
+ ;
+
+noInherit
+ : NO INHERIT
+ ;
+
+consTableSpace
+ : USING INDEX TABLESPACE name
+ ;
+
+definition
+ : LP_ defList RP_
+ ;
+
+defList
+ : defElem (COMMA_ defElem)*
+ ;
+
+defElem
+ : colLabel defArg?
+ ;
+
+colLabel
+ : identifier
+ | unreservedWord
+ | colNameKeyword
+ | typeFuncNameKeyword
+ | reservedKeyword
+ ;
+
+keyActions
+ : keyUpdate
+ | keyDelete
+ | keyUpdate keyDelete
+ | keyDelete keyUpdate
+ ;
+
+keyDelete
+ : ON DELETE keyAction
+ ;
+
+keyUpdate
+ : ON UPDATE keyAction
+ ;
+
+keyAction
+ : NO ACTION
+ | RESTRICT
+ | CASCADE
+ | SET NULL
+ | SET DEFAULT
+ ;
+
+keyMatch
+ : MATCH FULL | MATCH PARTIAL | MATCH SIMPLE
+ ;
+
+createGenericOptions
+ : ( OPTIONS LP_ genericOptionList RP_ )?
+ ;
Review comment:
Same as above.
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/PostgreSQLKeyword.g4
##########
@@ -1380,3 +1380,23 @@ VERBOSE
PARAM
: P A R A M
;
+
+REPLACCE
+ : R E P L A C C E
+ ;
Review comment:
It is not a keyword, maybe `REPLACE`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org