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 2022/06/19 13:50:41 UTC
[GitHub] [shardingsphere] everly-gif opened a new pull request, #18427: Support Parsing `ALTER PUBLICATION` in PostgreSQL
everly-gif opened a new pull request, #18427:
URL: https://github.com/apache/shardingsphere/pull/18427
Ref #17848
Changes proposed in this pull request:
- Proofread `ALTER PUBLICATION` grammar
- Support Parsing `ALTER PUBLICATION` in PostgreSQL
- Adds tests
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #18427: Support Parsing `ALTER PUBLICATION` in PostgreSQL
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #18427:
URL: https://github.com/apache/shardingsphere/pull/18427#discussion_r901185591
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4:
##########
@@ -1808,10 +1808,8 @@ relationExprList
;
relationExpr
- : qualifiedName
- | qualifiedName ASTERISK_
- | ONLY qualifiedName
- | ONLY LP_ qualifiedName RP_
+ : tableName (ASTERISK_)?
Review Comment:
Why change qualifiedName to tableName?
##########
shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/alter-publication.xml:
##########
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<sql-cases>
+ <sql-case id="alter_publication_rename" value="ALTER PUBLICATION old_publication RENAME TO new_publication;" db-types="PostgreSQL" />
+ <sql-case id="alter_publication_owner" value="ALTER PUBLICATION new_publication OWNER TO CURRENT_ROLE;" db-types="PostgreSQL" />
+ <sql-case id="alter_publication_set_table" value="ALTER PUBLICATION mypublication SET TABLE users, departments;" db-types="PostgreSQL" />
+ <sql-case id="alter_publication_add_table" value="ALTER PUBLICATION mypublication ADD TABLE stores, cities;" db-types="PostgreSQL" />
+ <sql-case id="alter_publication_drop_table" value="ALTER PUBLICATION mypublication DROP TABLE users;" db-types="PostgreSQL" />
+ <sql-case id="alter_publication_set_definition" value="ALTER PUBLICATION noinsert SET (publish = 'update, delete');" db-types="PostgreSQL" />
+
Review Comment:
Please remove these useless blank lines.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] everly-gif commented on a diff in pull request #18427: Support Parsing `ALTER PUBLICATION` in PostgreSQL
Posted by GitBox <gi...@apache.org>.
everly-gif commented on code in PR #18427:
URL: https://github.com/apache/shardingsphere/pull/18427#discussion_r901225728
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4:
##########
@@ -1808,10 +1808,8 @@ relationExprList
;
relationExpr
- : qualifiedName
- | qualifiedName ASTERISK_
- | ONLY qualifiedName
- | ONLY LP_ qualifiedName RP_
+ : tableName (ASTERISK_)?
Review Comment:
I chose tableName because it matches with the syntax name provided in the docs
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #18427: Support Parsing `ALTER PUBLICATION` in PostgreSQL
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #18427:
URL: https://github.com/apache/shardingsphere/pull/18427#discussion_r901227941
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4:
##########
@@ -1808,10 +1808,8 @@ relationExprList
;
relationExpr
- : qualifiedName
- | qualifiedName ASTERISK_
- | ONLY qualifiedName
- | ONLY LP_ qualifiedName RP_
+ : tableName (ASTERISK_)?
Review Comment:
Hi @everly-gif Can you take a look at PostgreSQL SQL parser source code? We need to be consistent with it to ensure grammatical correctness.
Following is the syntax definition in the PostgreSQL gram.y file:
```
relation_expr:
qualified_name OptSnapshotVersion
{
/* default inheritance */
$$ = $1;
if ($2 != NULL)
{
char *snapshot_name = (char *)palloc0(strlen($1->relname) + 1 + strlen($2) + 1);
sprintf(snapshot_name, "%s%c%s", $1->relname, DB4AI_SNAPSHOT_VERSION_DELIMITER, $2);
$$->relname = snapshot_name;
}
$$->inhOpt = INH_DEFAULT;
$$->alias = NULL;
}
| qualified_name '*'
{
/* inheritance query */
$$ = $1;
$$->inhOpt = INH_YES;
$$->alias = NULL;
}
| ONLY qualified_name
{
/* no inheritance */
$$ = $2;
$$->inhOpt = INH_NO;
$$->alias = NULL;
}
| ONLY '(' qualified_name ')'
{
/* no inheritance, SQL99-style syntax */
$$ = $3;
$$->inhOpt = INH_NO;
$$->alias = NULL;
}
;
relation_expr_list:
relation_expr { $$ = list_make1($1); }
| relation_expr_list ',' relation_expr { $$ = lappend($1, $3); }
;
```
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] everly-gif commented on a diff in pull request #18427: Support Parsing `ALTER PUBLICATION` in PostgreSQL
Posted by GitBox <gi...@apache.org>.
everly-gif commented on code in PR #18427:
URL: https://github.com/apache/shardingsphere/pull/18427#discussion_r901227274
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4:
##########
@@ -1808,10 +1808,8 @@ relationExprList
;
relationExpr
- : qualifiedName
- | qualifiedName ASTERISK_
- | ONLY qualifiedName
- | ONLY LP_ qualifiedName RP_
+ : tableName (ASTERISK_)?
Review Comment:
https://www.postgresql.org/docs/current/sql-alterpublication.html
Do you think we should keep it as qualifiedName?
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu merged pull request #18427: Support Parsing `ALTER PUBLICATION` in PostgreSQL
Posted by GitBox <gi...@apache.org>.
strongduanmu merged PR #18427:
URL: https://github.com/apache/shardingsphere/pull/18427
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] everly-gif commented on a diff in pull request #18427: Support Parsing `ALTER PUBLICATION` in PostgreSQL
Posted by GitBox <gi...@apache.org>.
everly-gif commented on code in PR #18427:
URL: https://github.com/apache/shardingsphere/pull/18427#discussion_r901242262
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4:
##########
@@ -1808,10 +1808,8 @@ relationExprList
;
relationExpr
- : qualifiedName
- | qualifiedName ASTERISK_
- | ONLY qualifiedName
- | ONLY LP_ qualifiedName RP_
+ : tableName (ASTERISK_)?
Review Comment:
Thank you for sharing, changing it back to qualifiedName
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-commenter commented on pull request #18427: Support Parsing `ALTER PUBLICATION` in PostgreSQL
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #18427:
URL: https://github.com/apache/shardingsphere/pull/18427#issuecomment-1159743963
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/18427?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#18427](https://codecov.io/gh/apache/shardingsphere/pull/18427?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (76505f1) into [master](https://codecov.io/gh/apache/shardingsphere/commit/f51ace448a172a818b53be3a4dfa686137fe9cd5?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f51ace4) will **increase** coverage by `0.00%`.
> The diff coverage is `71.42%`.
```diff
@@ Coverage Diff @@
## master #18427 +/- ##
=========================================
Coverage 59.05% 59.05%
- Complexity 2257 2258 +1
=========================================
Files 3727 3730 +3
Lines 54855 54862 +7
Branches 8016 8016
=========================================
+ Hits 32393 32398 +5
- Misses 19694 19696 +2
Partials 2768 2768
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/18427?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...ommon/statement/ddl/AlterPublicationStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/18427/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29tbW9uL3N0YXRlbWVudC9kZGwvQWx0ZXJQdWJsaWNhdGlvblN0YXRlbWVudC5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...resql/ddl/PostgreSQLAlterPublicationStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/18427/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvZGlhbGVjdC9zdGF0ZW1lbnQvcG9zdGdyZXNxbC9kZGwvUG9zdGdyZVNRTEFsdGVyUHVibGljYXRpb25TdGF0ZW1lbnQuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...atement/impl/PostgreSQLDDLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/18427/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1wb3N0Z3Jlc3FsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zcWwvcGFyc2VyL3Bvc3RncmVzcWwvdmlzaXRvci9zdGF0ZW1lbnQvaW1wbC9Qb3N0Z3JlU1FMRERMU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `80.66% <100.00%> (+0.05%)` | :arrow_up: |
| [...l/parser/core/database/visitor/SQLVisitorRule.java](https://codecov.io/gh/apache/shardingsphere/pull/18427/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWVuZ2luZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9jb3JlL2RhdGFiYXNlL3Zpc2l0b3IvU1FMVmlzaXRvclJ1bGUuamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [...eterized/jaxb/cases/domain/SQLParserTestCases.java](https://codecov.io/gh/apache/shardingsphere/pull/18427/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvamF4Yi9jYXNlcy9kb21haW4vU1FMUGFyc2VyVGVzdENhc2VzLmphdmE=) | `99.86% <100.00%> (+<0.01%)` | :arrow_up: |
| [...atement/ddl/AlterPublicationStatementTestCase.java](https://codecov.io/gh/apache/shardingsphere/pull/18427/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvamF4Yi9jYXNlcy9kb21haW4vc3RhdGVtZW50L2RkbC9BbHRlclB1YmxpY2F0aW9uU3RhdGVtZW50VGVzdENhc2UuamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [...ore/statement/ShardingSpherePreparedStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/18427/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtamRiYy9zaGFyZGluZ3NwaGVyZS1qZGJjLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RyaXZlci9qZGJjL2NvcmUvc3RhdGVtZW50L1NoYXJkaW5nU3BoZXJlUHJlcGFyZWRTdGF0ZW1lbnQuamF2YQ==) | `63.25% <0.00%> (ø)` | |
| [...eadwritesplitting/rule/ReadwriteSplittingRule.java](https://codecov.io/gh/apache/shardingsphere/pull/18427/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtcmVhZHdyaXRlLXNwbGl0dGluZy9zaGFyZGluZ3NwaGVyZS1yZWFkd3JpdGUtc3BsaXR0aW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3JlYWR3cml0ZXNwbGl0dGluZy9ydWxlL1JlYWR3cml0ZVNwbGl0dGluZ1J1bGUuamF2YQ==) | `57.14% <0.00%> (ø)` | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/18427?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/18427?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f51ace4...76505f1](https://codecov.io/gh/apache/shardingsphere/pull/18427?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org