This is an automated email from the ASF dual-hosted git repository.

jianglongtao 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 3dd8a4e2cb3 No successful response from pg client when executing 
DistSQL. (#16847)
3dd8a4e2cb3 is described below

commit 3dd8a4e2cb30f4595b4a5420b6e1e43fc6694768
Author: lanchengx <[email protected]>
AuthorDate: Fri Apr 15 18:14:41 2022 +0800

    No successful response from pg client when executing DistSQL. (#16847)
---
 .../frontend/postgresql/command/query/PostgreSQLCommand.java      | 8 ++++----
 .../frontend/postgresql/command/query/PostgreSQLCommandTest.java  | 8 +++++---
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommand.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommand.java
index c4c0f1d6312..b687e0f1c6c 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommand.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommand.java
@@ -18,8 +18,7 @@
 package org.apache.shardingsphere.proxy.frontend.postgresql.command.query;
 
 import lombok.Getter;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.AddResourceStatement;
-import 
org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingTableRuleStatement;
+import org.apache.shardingsphere.distsql.parser.statement.DistSQLStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dal.AnalyzeTableStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dal.ResetParameterStatement;
@@ -71,6 +70,7 @@ import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * PostgreSQL command.
+ *
  * @see <a href="https://www.postgresql.org/docs/13/sql-commands.html";>SQL 
Commands</a>
  */
 @Getter
@@ -91,7 +91,6 @@ public enum PostgreSQLCommand {
     ALTER_TABLESPACE(AlterTablespaceStatement.class),
     ALTER_TABLE(AlterTableStatement.class),
     ALTER_VIEW(AlterViewStatement.class),
-    CREATE(AddResourceStatement.class, CreateShardingTableRuleStatement.class),
     CREATE_DATABASE(CreateDatabaseStatement.class),
     CREATE_FUNCTION(CreateFunctionStatement.class),
     CREATE_INDEX(CreateIndexStatement.class),
@@ -116,7 +115,8 @@ public enum PostgreSQLCommand {
     ROLLBACK(RollbackStatement.class),
     RELEASE(ReleaseSavepointStatement.class),
     SET(SetStatement.class, SetTransactionStatement.class),
-    RESET(ResetParameterStatement.class);
+    RESET(ResetParameterStatement.class),
+    SUCCESS(DistSQLStatement.class);
     
     private static final Map<Class<? extends SQLStatement>, 
Optional<PostgreSQLCommand>> COMPUTED_CLASSES = new ConcurrentHashMap<>(64, 1);
     
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommandTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommandTest.java
index 942110f40b8..1ec468013db 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommandTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommandTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.proxy.frontend.postgresql.command.query;
 
+import org.apache.shardingsphere.distsql.parser.statement.DistSQLStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.AddResourceStatement;
 import 
org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingTableRuleStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
@@ -175,9 +176,10 @@ public final class PostgreSQLCommandTest {
     
     @Test
     public void 
assertValueOfCreateShardingTableRuleOrCreateDataSourcesStatement() {
-        
assertThat(PostgreSQLCommand.valueOf(AddResourceStatement.class).orElse(null), 
is(PostgreSQLCommand.CREATE));
-        
assertThat(PostgreSQLCommand.valueOf(CreateShardingTableRuleStatement.class).orElse(null),
 is(PostgreSQLCommand.CREATE));
-        assertThat(PostgreSQLCommand.CREATE.getTag(), is("CREATE"));
+        
assertThat(PostgreSQLCommand.valueOf(AddResourceStatement.class).orElse(null), 
is(PostgreSQLCommand.SUCCESS));
+        
assertThat(PostgreSQLCommand.valueOf(CreateShardingTableRuleStatement.class).orElse(null),
 is(PostgreSQLCommand.SUCCESS));
+        
assertThat(PostgreSQLCommand.valueOf(DistSQLStatement.class).orElse(null), 
is(PostgreSQLCommand.SUCCESS));
+        assertThat(PostgreSQLCommand.SUCCESS.getTag(), is("SUCCESS"));
     }
     
     @Test

Reply via email to