You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/02/18 08:03:10 UTC
[shardingsphere] branch master updated: support declare for pg/og (#15491)
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 ea9cf5a support declare for pg/og (#15491)
ea9cf5a is described below
commit ea9cf5a0090c143b2e49a02d662f696645ec8583
Author: tuichenchuxin <86...@users.noreply.github.com>
AuthorDate: Fri Feb 18 16:02:11 2022 +0800
support declare for pg/og (#15491)
---
.../sql/parser/autogen/OpenGaussStatement.g4 | 1 +
.../impl/OpenGaussDDLStatementSQLVisitor.java | 7 ++
.../sql/parser/autogen/PostgreSQLStatement.g4 | 1 +
.../impl/PostgreSQLDDLStatementSQLVisitor.java | 7 ++
.../core/database/visitor/SQLVisitorRule.java | 2 +
.../sql/common/statement/ddl/DeclareStatement.java | 28 +++++++
.../opengauss/ddl/OpenGaussDeclareStatement.java | 29 +++++++
.../postgresql/ddl/PostgreSQLDeclareStatement.java | 29 +++++++
.../jaxb/cases/domain/SQLParserTestCases.java | 5 ++
.../statement/ddl/DeclareStatementTestCase.java | 26 +++++++
.../src/main/resources/case/ddl/declare.xml | 21 +++++
.../main/resources/sql/supported/ddl/declare.xml | 21 +++++
.../main/resources/sql/unsupported/unsupported.xml | 90 ----------------------
13 files changed, 177 insertions(+), 90 deletions(-)
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/OpenGaussStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/OpenGaussStatement.g4
index e0fe197..52848f3 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/OpenGaussStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/OpenGaussStatement.g4
@@ -76,6 +76,7 @@ execute
| createSchema
| createType
| createTextSearch
+ | declare
| dropDatabase
| dropFunction
| dropProcedure
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java
index 01fcfa1..f405377 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java
@@ -95,6 +95,7 @@ import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.Alt
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.ValidateConstraintSpecificationContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.AlterGroupContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.AlterMaterializedViewContext;
+import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.DeclareContext;
import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.AlterDefinitionSegment;
import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.CreateDefinitionSegment;
import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.column.ColumnDefinitionSegment;
@@ -153,6 +154,7 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateTypeStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateViewStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussDeallocateStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussDeclareStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussDropConversionStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussDropDatabaseStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussDropDomainStatement;
@@ -724,4 +726,9 @@ public final class OpenGaussDDLStatementSQLVisitor extends OpenGaussStatementSQL
public ASTNode visitDropExtension(final DropExtensionContext ctx) {
return new OpenGaussDropExtensionStatement();
}
+
+ @Override
+ public ASTNode visitDeclare(final DeclareContext ctx) {
+ return new OpenGaussDeclareStatement();
+ }
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/PostgreSQLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/PostgreSQLStatement.g4
index 4f684e6..ae8523a 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/PostgreSQLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/PostgreSQLStatement.g4
@@ -78,6 +78,7 @@ execute
| createSchema
| createType
| createTextSearch
+ | declare
| dropDatabase
| dropFunction
| dropProcedure
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 c0d6070..125aad4 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
@@ -97,6 +97,7 @@ import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.Va
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.AlterForeignTableContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.AlterGroupContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.AlterMaterializedViewContext;
+import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.DeclareContext;
import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.AlterDefinitionSegment;
import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.CreateDefinitionSegment;
import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.column.ColumnDefinitionSegment;
@@ -157,6 +158,7 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLCreateTypeStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLCreateViewStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLDeallocateStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLDeclareStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLDropConversionStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLDropDatabaseStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLDropDomainStatement;
@@ -738,4 +740,9 @@ public final class PostgreSQLDDLStatementSQLVisitor extends PostgreSQLStatementS
public ASTNode visitDropExtension(final DropExtensionContext ctx) {
return new PostgreSQLDropExtensionStatement();
}
+
+ @Override
+ public ASTNode visitDeclare(final DeclareContext ctx) {
+ return new PostgreSQLDeclareStatement();
+ }
}
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 22ce123..b1f46c2 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
@@ -184,6 +184,8 @@ public enum SQLVisitorRule {
DROP_EXTENSION("DropExtension", SQLStatementType.DDL),
+ DECLARE("Declare", SQLStatementType.DDL),
+
SET_CONSTRAINTS("SetConstraints", SQLStatementType.TCL),
SET_TRANSACTION("SetTransaction", SQLStatementType.TCL),
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/DeclareStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/DeclareStatement.java
new file mode 100644
index 0000000..e109ba2
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/DeclareStatement.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;
+
+/**
+ * Declare statement.
+ */
+@ToString
+public abstract class DeclareStatement 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/opengauss/ddl/OpenGaussDeclareStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussDeclareStatement.java
new file mode 100644
index 0000000..d7e1bd4
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussDeclareStatement.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.opengauss.ddl;
+
+import lombok.ToString;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DeclareStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.OpenGaussStatement;
+
+/**
+ * OpenGauss declare statement.
+ */
+@ToString
+public final class OpenGaussDeclareStatement extends DeclareStatement implements OpenGaussStatement {
+}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDeclareStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDeclareStatement.java
new file mode 100644
index 0000000..a6ea8fa
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDeclareStatement.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.DeclareStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.PostgreSQLStatement;
+
+/**
+ * PostgreSQL declare statement.
+ */
+@ToString
+public final class PostgreSQLDeclareStatement extends DeclareStatement implements PostgreSQLStatement {
+}
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 b504ced..d2eb659 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
@@ -137,6 +137,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.CreateTriggerStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.CreateTypeStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.CreateViewStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.DeclareStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.DisassociateStatisticsStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.DropConversionStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.DropDatabaseStatementTestCase;
@@ -542,6 +543,9 @@ public final class SQLParserTestCases {
@XmlElement(name = "drop-extension")
private final List<DropExtensionStatementTestCase> dropExtensionStatementTestCase = new LinkedList<>();
+ @XmlElement(name = "declare")
+ private final List<DeclareStatementTestCase> declareStatementTestCase = new LinkedList<>();
+
@XmlElement(name = "drop-database")
private final List<DropDatabaseStatementTestCase> dropDatabaseTestCase = new LinkedList<>();
@@ -1383,6 +1387,7 @@ public final class SQLParserTestCases {
putAll(countSchemaRulesStatementTestCases, result);
putAll(alterExtensionStatementTestCase, result);
putAll(dropExtensionStatementTestCase, result);
+ putAll(declareStatementTestCase, result);
putAll(lockStatementTestCases, result);
putAll(unlockStatementTestCases, result);
putAll(exportSchemaConfigurationStatementTestCases, result);
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/DeclareStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/DeclareStatementTestCase.java
new file mode 100644
index 0000000..09b9248
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/DeclareStatementTestCase.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;
+
+/**
+ * Declare statement test case.
+ */
+public final class DeclareStatementTestCase extends SQLParserTestCase {
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/declare.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/declare.xml
new file mode 100644
index 0000000..d466dea
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/declare.xml
@@ -0,0 +1,21 @@
+<?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>
+ <declare sql-case-id="declare" />
+</sql-parser-test-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/declare.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/declare.xml
new file mode 100644
index 0000000..9589750
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/declare.xml
@@ -0,0 +1,21 @@
+<?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="declare" value="DECLARE bc BINARY CURSOR FOR SELECT * FROM tenk1;" db-types="PostgreSQL,openGauss" />
+</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 b2e1cbc..9b2706e 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
@@ -5894,84 +5894,6 @@
<sql-case id="create_by_postgresql_source_test_case877" value="CREATE VIEW tableam_view_heap2 USING heap2 AS SELECT * FROM tableam_tbl_heap2;" db-types="PostgreSQL"/>
<sql-case id="create_by_postgresql_source_test_case878" value="CREATE foo;" db-types="PostgreSQL"/>
<sql-case id="ddd 42_by_postgresql_source_test_case1" value="DDD 42 drop trigger child1_insert_trig on child1;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case1" value="DECLARE bc BINARY CURSOR FOR SELECT * FROM tenk1;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case2" value="DECLARE c CURSOR FOR SELECT * FROM tenk1 JOIN tenk2 USING (unique1);" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case3" value="DECLARE c CURSOR FOR SELECT * FROM tenk2 FOR SHARE;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case4" value="DECLARE c CURSOR FOR SELECT * FROM tenk2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case5" value="DECLARE c CURSOR FOR SELECT * from hash_split_heap WHERE keycol = 1;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case6" value="DECLARE c CURSOR FOR SELECT ctid, * FROM tidscan WHERE ctid = ANY(ARRAY['(0,1)', '(0,2)']::tid[]);" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case7" value="DECLARE c CURSOR FOR SELECT ctid, * FROM tidscan;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case8" value="DECLARE c CURSOR FOR SELECT ctid,cmin,* FROM combocidtest;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case9" value="DECLARE c CURSOR FOR SELECT f1,count(*) FROM uctest GROUP BY f1;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case10" value="DECLARE c SCROLL CURSOR FOR SELECT ctid FROM tidrangescan WHERE ctid < '(1,0)';" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case11" value="DECLARE c SCROLL CURSOR FOR SELECT noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_decreasing;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case12" value="DECLARE c SCROLL CURSOR FOR SELECT noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_decreasing;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case13" value="DECLARE c1 CURSOR FOR SELECT * FROM uctest FOR UPDATE;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case14" value="DECLARE c1 CURSOR FOR SELECT * FROM uctest FOR UPDATE;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case15" value="DECLARE c1 CURSOR FOR SELECT * FROM uctest FOR UPDATE;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case16" value="DECLARE c1 CURSOR FOR SELECT * FROM uctest a, uctest b WHERE a.f1 = b.f1 + 5 FOR SHARE OF a;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case17" value="DECLARE c1 CURSOR FOR SELECT * FROM uctest a, uctest b WHERE a.f1 = b.f1 + 5 FOR UPDATE;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case18" value="DECLARE c1 CURSOR FOR SELECT * FROM uctest a, uctest b WHERE a.f1 = b.f1 + 5;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case19" value="DECLARE c1 CURSOR FOR SELECT * FROM uctest;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case20" value="DECLARE c1 CURSOR FOR SELECT * FROM uctest;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case21" value="DECLARE c1 CURSOR FOR SELECT * FROM uctest;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case22" value="DECLARE c1 CURSOR FOR SELECT * FROM ucview;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case23" value="DECLARE c1 CURSOR FOR SELECT MIN(f1) FROM uctest FOR UPDATE;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case24" value="DECLARE c1 CURSOR FOR SELECT stringu1 FROM onek WHERE stringu1 = 'DZAAAA';" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case25" value="DECLARE c1 INSENSITIVE CURSOR FOR SELECT * FROM uctest;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case26" value="DECLARE c1 NO SCROLL CURSOR FOR SELECT * FROM cursor FOR UPDATE;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case27" value="DECLARE c1 SCROLL CURSOR FOR SELECT * FROM current_check;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case28" value="DECLARE current_check_cursor SCROLL CURSOR FOR SELECT * FROM current_check;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case29" value="DECLARE cx CURSOR WITH HOLD FOR SELECT * FROM uctest;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case30" value="DECLARE foo CURSOR FOR SELECT * FROM pxtest4;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case31" value="DECLARE foo CURSOR FOR SELECT 1 INTO b;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case32" value="DECLARE foo CURSOR WITH HOLD FOR SELECT 1;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case33" value="DECLARE foo1 CURSOR WITH HOLD FOR SELECT 1;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case34" value="DECLARE foo1 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case35" value="DECLARE foo10 SCROLL CURSOR FOR SELECT * FROM tenk2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case36" value="DECLARE foo11 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case37" value="DECLARE foo12 SCROLL CURSOR FOR SELECT * FROM tenk2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case38" value="DECLARE foo13 CURSOR FOR SELECT * FROM onek WHERE unique1 = 50;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case39" value="DECLARE foo13 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case40" value="DECLARE foo14 CURSOR FOR SELECT * FROM onek WHERE unique1 = 51;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case41" value="DECLARE foo14 SCROLL CURSOR FOR SELECT * FROM tenk2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case42" value="DECLARE foo15 CURSOR FOR SELECT * FROM onek WHERE unique1 = 52;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case43" value="DECLARE foo15 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case44" value="DECLARE foo16 CURSOR FOR SELECT * FROM onek WHERE unique1 = 53;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case45" value="DECLARE foo16 SCROLL CURSOR FOR SELECT * FROM tenk2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case46" value="DECLARE foo17 CURSOR FOR SELECT * FROM onek WHERE unique1 = 54;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case47" value="DECLARE foo17 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case48" value="DECLARE foo18 CURSOR FOR SELECT * FROM onek WHERE unique1 = 55;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case49" value="DECLARE foo18 SCROLL CURSOR FOR SELECT * FROM tenk2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case50" value="DECLARE foo19 CURSOR FOR SELECT * FROM onek WHERE unique1 = 56;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case51" value="DECLARE foo19 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case52" value="DECLARE foo2 CURSOR WITHOUT HOLD FOR SELECT 1;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case53" value="DECLARE foo2 SCROLL CURSOR FOR SELECT * FROM tenk2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case54" value="DECLARE foo20 CURSOR FOR SELECT * FROM onek WHERE unique1 = 57;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case55" value="DECLARE foo20 SCROLL CURSOR FOR SELECT * FROM tenk2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case56" value="DECLARE foo21 CURSOR FOR SELECT * FROM onek WHERE unique1 = 58;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case57" value="DECLARE foo21 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case58" value="DECLARE foo22 CURSOR FOR SELECT * FROM onek WHERE unique1 = 59;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case59" value="DECLARE foo22 SCROLL CURSOR FOR SELECT * FROM tenk2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case60" value="DECLARE foo23 CURSOR FOR SELECT * FROM onek WHERE unique1 = 60;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case61" value="DECLARE foo23 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case62" value="DECLARE foo24 CURSOR FOR SELECT * FROM onek2 WHERE unique1 = 50;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case63" value="DECLARE foo24 NO SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case64" value="DECLARE foo24 NO SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case65" value="DECLARE foo25 CURSOR FOR SELECT * FROM onek2 WHERE unique1 = 60;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case66" value="DECLARE foo25 SCROLL CURSOR WITH HOLD FOR SELECT * FROM tenk2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case67" value="DECLARE foo25ns NO SCROLL CURSOR WITH HOLD FOR SELECT * FROM tenk2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case68" value="DECLARE foo26 CURSOR WITH HOLD FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case69" value="DECLARE foo3 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case70" value="DECLARE foo4 SCROLL CURSOR FOR SELECT * FROM tenk2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case71" value="DECLARE foo5 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case72" value="DECLARE foo6 SCROLL CURSOR FOR SELECT * FROM tenk2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case73" value="DECLARE foo7 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case74" value="DECLARE foo8 SCROLL CURSOR FOR SELECT * FROM tenk2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case75" value="DECLARE foo9 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case76" value="DECLARE hsc CURSOR FOR select * from hs3;" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case77" value="DECLARE tablesample_cur SCROLL CURSOR FOR SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (50) REPEATABLE (0);" db-types="PostgreSQL"/>
- <sql-case id="declare_by_postgresql_source_test_case78" value="DECLARE xc CURSOR WITH HOLD FOR SELECT * FROM testxmlschema.test1 ORDER BY 1, 2;" db-types="PostgreSQL"/>
<sql-case id="delete_by_postgresql_source_test_case1" value="DELETE FROM arrtest WHERE a[2] IS NULL AND b IS NULL;" db-types="PostgreSQL"/>
<sql-case id="delete_by_postgresql_source_test_case2" value="DELETE FROM current_check WHERE CURRENT OF c1 RETURNING *;" db-types="PostgreSQL"/>
<sql-case id="delete_by_postgresql_source_test_case3" value="DELETE FROM current_check WHERE CURRENT OF c1 RETURNING *;" db-types="PostgreSQL"/>
@@ -9351,18 +9273,6 @@
<sql-case id="low_create_by_postgresql_source_test_case559" value="create view tt201v as select extract(day from now()) as extr, (now(), '1 day'::interval) overlaps (current_timestamp(2), '1 day'::interval) as o, 'foo' is normalized isn, 'foo' is nfkc normalized isnn, normalize('foo') as n, normalize('foo', nfkd) as nfkd, overlay('foo' placing 'bar' from 2) as ovl, overlay('foo&ap [...]
<sql-case id="low_create_by_postgresql_source_test_case560" value="create view tt26v as select x + y + z as c1, (x * y) + z as c2, x + (y * z) as c3, (x + y) * z as c4, x * (y + z) as c5, x + (y + z) as c6, x + (y # z) as c7, (x > y) AND (y > z OR x > z) as c8, (x > y) OR (y > z AND NOT (x > z)) as c9, (x,y) <> ALL (values(1,2),(3,4)) as c10, (x,y) <= ANY (values(1,2),(3,4)) as c11 from ( [...]
<sql-case id="low_create_by_postgresql_source_test_case561" value="create view view_of_joins_2d as select * from (tbl1 join tbl1a using (a) as x) as y;" db-types="PostgreSQL"/>
- <sql-case id="low_declare_by_postgresql_source_test_case1" value="declare c cursor for select * from int8_tbl limit nochange(3);" db-types="PostgreSQL"/>
- <sql-case id="low_declare_by_postgresql_source_test_case2" value="declare c1 cursor for select * from int8_tbl limit 10;" db-types="PostgreSQL"/>
- <sql-case id="low_declare_by_postgresql_source_test_case3" value="declare c1 cursor for select count_tt1_v(), count_tt1_s();" db-types="PostgreSQL"/>
- <sql-case id="low_declare_by_postgresql_source_test_case4" value="declare c1 scroll cursor for select * from generate_series(1,4) i where i <> all (values (2),(3));" db-types="PostgreSQL"/>
- <sql-case id="low_declare_by_postgresql_source_test_case5" value="declare c1 scroll cursor for select (select 42) as x;" db-types="PostgreSQL"/>
- <sql-case id="low_declare_by_postgresql_source_test_case6" value="declare c2 cursor for select * from int8_tbl limit 3;" db-types="PostgreSQL"/>
- <sql-case id="low_declare_by_postgresql_source_test_case7" value="declare c2 cursor with hold for select count_tt1_v(), count_tt1_s();" db-types="PostgreSQL"/>
- <sql-case id="low_declare_by_postgresql_source_test_case8" value="declare c2 scroll cursor for select generate_series(1,3) as g;" db-types="PostgreSQL"/>
- <sql-case id="low_declare_by_postgresql_source_test_case9" value="declare c3 cursor for select * from int8_tbl offset 3;" db-types="PostgreSQL"/>
- <sql-case id="low_declare_by_postgresql_source_test_case10" value="declare c4 cursor for select * from int8_tbl offset 10;" db-types="PostgreSQL"/>
- <sql-case id="low_declare_by_postgresql_source_test_case11" value="declare c5 cursor for select * from int8_tbl order by q1 fetch first 2 rows with ties;" db-types="PostgreSQL"/>
- <sql-case id="low_declare_by_postgresql_source_test_case12" value="declare cur SCROLL CURSOR for select 1 from list_part where a > (select 1) and a < (select 4);" db-types="PostgreSQL"/>
<sql-case id="low_declare_by_postgresql_source_test_case13" value="declare rf_cur scroll cursor for select * from rows from(generate_series(1,5),generate_series(1,2)) with ordinality as g(i,j,o);" db-types="PostgreSQL"/>
<sql-case id="low_delete_by_postgresql_source_test_case1" value="delete from;" db-types="PostgreSQL"/>
<sql-case id="low_discard_by_postgresql_source_test_case1" value="discard all;" db-types="PostgreSQL"/>