This is an automated email from the ASF dual-hosted git repository. duanzhengqiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push: new 09fa70b4608 support notify statement (#18714) 09fa70b4608 is described below commit 09fa70b4608568fc30cf87915c940b0182f1ebd4 Author: Runqi Zhao <40480634+zrsa...@users.noreply.github.com> AuthorDate: Thu Jun 30 10:23:53 2022 +0800 support notify statement (#18714) --- .../main/antlr4/imports/postgresql/DDLStatement.g4 | 8 ++--- .../parser/autogen/PostgreSQLStatementParser.g4 | 1 + .../impl/PostgreSQLDDLStatementSQLVisitor.java | 7 ++++ .../core/database/visitor/SQLVisitorRule.java | 2 ++ .../common/statement/ddl/NotifyStmtStatement.java | 28 ++++++++++++++++ .../ddl/PostgreSQLNotifyStmtStatement.java | 29 +++++++++++++++++ .../asserts/statement/ddl/DDLStatementAssert.java | 5 +++ .../ddl/impl/NotifyStmtStatementAssert.java | 38 ++++++++++++++++++++++ .../jaxb/cases/domain/SQLParserTestCases.java | 5 +++ .../statement/ddl/NotifyStmtStatementTestCase.java | 26 +++++++++++++++ .../src/main/resources/case/ddl/notify.xml | 22 +++++++++++++ .../main/resources/sql/supported/ddl/notify.xml | 23 +++++++++++++ .../main/resources/sql/unsupported/unsupported.xml | 2 -- 13 files changed, 190 insertions(+), 6 deletions(-) diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4 index ed8b528712d..5e34c0f1128 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4 +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4 @@ -1491,10 +1491,6 @@ ruleActionMulti : ruleActionStmt? (SEMI_ ruleActionStmt?)* ; -notifyStmt - : NOTIFY colId (COMMA_ STRING_)? - ; - createTrigger : CREATE TRIGGER name triggerActionTime triggerEvents ON qualifiedName triggerReferencing? triggerForSpec? triggerWhen? EXECUTE (FUNCTION | PROCEDURE) funcName LP_ triggerFuncArgs? RP_ | CREATE CONSTRAINT TRIGGER (FROM qualifiedName)? constraintAttributeSpec FOR EACH ROW triggerWhen EXECUTE (FUNCTION | PROCEDURE) funcName LP_ triggerFuncArgs RP_ @@ -1799,6 +1795,10 @@ unlisten : UNLISTEN (channelName | ASTERISK_) ; +notifyStmt + : NOTIFY colId (COMMA_ STRING_)? + ; + direction : NEXT #next | PRIOR #prior diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/PostgreSQLStatementParser.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/PostgreSQLStatementParser.g4 index 96386c694e5..ad6a69011fa 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/PostgreSQLStatementParser.g4 +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/PostgreSQLStatementParser.g4 @@ -105,6 +105,7 @@ execute | explain | analyzeTable | listen + | notifyStmt | unlisten | load | createTablespace diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java index 8d13d08b996..8297bded548 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java @@ -155,6 +155,7 @@ import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.Tr import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.ValidateConstraintSpecificationContext; import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.ListenContext; import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.UnlistenContext; +import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.NotifyStmtContext; import org.apache.shardingsphere.sql.parser.sql.common.constant.DirectionType; import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.AlterDefinitionSegment; import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.CreateDefinitionSegment; @@ -274,6 +275,7 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLDropViewStatement; import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLFetchStatement; import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLMoveStatement; +import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLNotifyStmtStatement; import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLPrepareStatement; import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLTruncateStatement; import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLListenStatement; @@ -1267,4 +1269,9 @@ public final class PostgreSQLDDLStatementSQLVisitor extends PostgreSQLStatementS public ASTNode visitUnlisten(final UnlistenContext ctx) { return new PostgreSQLUnlistenStatement(); } + + @Override + public ASTNode visitNotifyStmt(final NotifyStmtContext ctx) { + return new PostgreSQLNotifyStmtStatement(); + } } diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java index 65f9efed45e..50612b312d0 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java @@ -246,6 +246,8 @@ public enum SQLVisitorRule { LISTEN("Listen", SQLStatementType.DDL), + NOTIFY("NotifyStmt", SQLStatementType.DDL), + UNLISTEN("Unlisten", SQLStatementType.DDL), SET_CONSTRAINTS("SetConstraints", SQLStatementType.TCL), diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/NotifyStmtStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/NotifyStmtStatement.java new file mode 100644 index 00000000000..f09252a47f6 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/NotifyStmtStatement.java @@ -0,0 +1,28 @@ +/* + * 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. + */ + +package org.apache.shardingsphere.sql.parser.sql.common.statement.ddl; + +import lombok.ToString; +import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement; + +/** + * Notify statement. + */ +@ToString +public abstract class NotifyStmtStatement extends AbstractSQLStatement implements DDLStatement { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLNotifyStmtStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLNotifyStmtStatement.java new file mode 100644 index 00000000000..7acbf957ccc --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLNotifyStmtStatement.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +package org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl; + +import lombok.ToString; +import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.NotifyStmtStatement; +import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.PostgreSQLStatement; + +/** + * PostgreSQL notify statement. + */ +@ToString +public final class PostgreSQLNotifyStmtStatement extends NotifyStmtStatement implements PostgreSQLStatement { +} diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/DDLStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/DDLStatementAssert.java index a2962f7c25a..c845d7ab655 100644 --- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/DDLStatementAssert.java +++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/DDLStatementAssert.java @@ -34,6 +34,7 @@ import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropTableSt import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.FetchStatement; import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.ListenStatement; import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.MoveStatement; +import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.NotifyStmtStatement; import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.RenameTableStatement; import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.TruncateStatement; import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.UnlistenStatement; @@ -67,6 +68,7 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.FetchStatementAssert; import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.MoveStatementAssert; import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.NoAuditStatementAssert; +import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.NotifyStmtStatementAssert; import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.RenameTableStatementAssert; import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.TruncateStatementAssert; import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.ListenStatementAssert; @@ -93,6 +95,7 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.FetchStatementTestCase; import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.MoveStatementTestCase; import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.NoAuditStatementTestCase; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.NotifyStmtStatementTestCase; import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.RenameTableStatementTestCase; import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.TruncateStatementTestCase; import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.ListenStatementTestCase; @@ -162,6 +165,8 @@ public final class DDLStatementAssert { ListenStatementAssert.assertIs(assertContext, (ListenStatement) actual, (ListenStatementTestCase) expected); } else if (actual instanceof UnlistenStatement) { UnlistenStatementAssert.assertIs(assertContext, (UnlistenStatement) actual, (UnlistenStatementTestCase) expected); + } else if (actual instanceof NotifyStmtStatement) { + NotifyStmtStatementAssert.assertIs(assertContext, (NotifyStmtStatement) actual, (NotifyStmtStatementTestCase) expected); } } } diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/NotifyStmtStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/NotifyStmtStatementAssert.java new file mode 100644 index 00000000000..e3acf398414 --- /dev/null +++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/NotifyStmtStatementAssert.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +package org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.NotifyStmtStatement; +import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.NotifyStmtStatementTestCase; + +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class NotifyStmtStatementAssert { + + /** + * Assert notify statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual notify statement + * @param expected expected notify statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final NotifyStmtStatement actual, final NotifyStmtStatementTestCase expected) { + } +} diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java index b4618af423f..b3b7afb150b 100644 --- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java +++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java @@ -236,6 +236,7 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.FlashbackTableStatementTestCase; import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.MoveStatementTestCase; import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.NoAuditStatementTestCase; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.NotifyStmtStatementTestCase; import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.PreparedStatementTestCase; import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.PurgeStatementTestCase; import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.RenameStatementTestCase; @@ -1333,6 +1334,9 @@ public final class SQLParserTestCases { @XmlElement(name = "listen") private final List<ListenStatementTestCase> listenTestCases = new LinkedList<>(); + @XmlElement(name = "notify") + private final List<NotifyStmtStatementTestCase> notifyTestCases = new LinkedList<>(); + @XmlElement(name = "unlisten") private final List<UnlistenStatementTestCase> unlistenTestCases = new LinkedList<>(); @@ -1847,6 +1851,7 @@ public final class SQLParserTestCases { putAll(createRollbackSegmentTestCases, result); putAll(dropRollbackSegmentTestCases, result); putAll(listenTestCases, result); + putAll(notifyTestCases, result); putAll(unlistenTestCases, result); putAll(createLockdownProfileTestCases, result); putAll(dropLockdownProfileTestCases, result); diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/NotifyStmtStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/NotifyStmtStatementTestCase.java new file mode 100644 index 00000000000..d18c512d9f0 --- /dev/null +++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/NotifyStmtStatementTestCase.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl; + +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase; + +/** + * Notify statement test case. + */ +public final class NotifyStmtStatementTestCase extends SQLParserTestCase { +} diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/notify.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/notify.xml new file mode 100644 index 00000000000..77132f816e2 --- /dev/null +++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/notify.xml @@ -0,0 +1,22 @@ +<?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-parser-test-cases> + <notify sql-case-id="notify"/> + <notify sql-case-id="notify_low"/> +</sql-parser-test-cases> diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/notify.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/notify.xml new file mode 100644 index 00000000000..645785593ea --- /dev/null +++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/notify.xml @@ -0,0 +1,23 @@ +<?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="notify" value="NOTIFY notify_async2;" db-types="PostgreSQL" /> + <sql-case id="notify_low" value="notify a;" db-types="PostgreSQL" /> +</sql-cases> + diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml index 6d1965e5400..c2c4fce3370 100644 --- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml +++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml @@ -4705,7 +4705,6 @@ <sql-case id="lock_by_postgresql_source_test_case39" value="LOCK hs1;" db-types="PostgreSQL" /> <sql-case id="lock_by_postgresql_source_test_case40" value="LOCK lock_tbl1 IN ROW SHARE MODE;" db-types="PostgreSQL" /> <sql-case id="lock_by_postgresql_source_test_case41" value="LOCK lock_tbl1 IN SHARE ROW EXCLUSIVE MODE;" db-types="PostgreSQL" /> - <sql-case id="notify_by_postgresql_source_test_case1" value="NOTIFY notify_async2;" db-types="PostgreSQL" /> <sql-case id="prepare_by_postgresql_source_test_case1" value="PREPARE TRANSACTION 'foo1';" db-types="PostgreSQL" /> <sql-case id="prepare_by_postgresql_source_test_case2" value="PREPARE TRANSACTION 'foo2';" db-types="PostgreSQL" /> <sql-case id="prepare_by_postgresql_source_test_case3" value="PREPARE TRANSACTION 'foo3';" db-types="PostgreSQL" /> @@ -6949,7 +6948,6 @@ <sql-case id="low_lock_by_postgresql_source_test_case1" value="lock table pxtest3 in access share mode nowait;" db-types="PostgreSQL" /> <sql-case id="low_lock_by_postgresql_source_test_case2" value="lock table pxtest3 in access share mode nowait;" db-types="PostgreSQL" /> <sql-case id="low_lock_by_postgresql_source_test_case3" value="lock twophase_tab in access exclusive mode;" db-types="PostgreSQL" /> - <sql-case id="low_notify_by_postgresql_source_test_case1" value="notify a;" db-types="PostgreSQL" /> <sql-case id="low_prepare_by_postgresql_source_test_case1" value="prepare q as select 'some"text' as "a&title", E' <foo>\n<bar>' as "junk", ' ' as "empty", n as int from generate_series(1,2) as n;" db-types="PostgreSQL" /> <sql-case id="low_prepare_by_postgresql_source_test_case2" value="prepare q as select 'some\more_text' as "a$title", E' #<foo>%&^~|\n{bar}' as "junk", ' ' as "empty", n as int from generate_series(1,2) as n;" db-types="PostgreSQL" /> <sql-case id="low_prepare_by_postgresql_source_test_case3" value="prepare q as select 'some\more_text' as "a$title", E' #<foo>%&^~|\n{bar}' as "junk", ' ' as "empty", n as int from generate_series(1,2) as n;" db-types="PostgreSQL" />