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

zhangliang 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 dc033b4  Fix Row Description may be missing for PostgreSQL (#10636)
dc033b4 is described below

commit dc033b4aa08c49bf9702b4efa57e1ec4f23d0b3f
Author: 吴伟杰 <[email protected]>
AuthorDate: Thu Jun 3 17:16:24 2021 +0800

    Fix Row Description may be missing for PostgreSQL (#10636)
    
    * Fix Row Description may be missing for PostgreSQL
    
    * Fix testcase
---
 .../command/query/binary/bind/PostgreSQLComBindExecutor.java      | 2 +-
 .../command/query/binary/bind/PostgreSQLComBindExecutorTest.java  | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutor.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutor.java
index 9343dee..e7039c7 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutor.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutor.java
@@ -110,7 +110,7 @@ public final class PostgreSQLComBindExecutor implements 
QueryCommandExecutor {
     
     private Optional<PostgreSQLRowDescriptionPacket> createQueryPacket(final 
QueryResponseHeader queryResponseHeader) {
         Collection<PostgreSQLColumnDescription> columnDescriptions = 
createColumnDescriptions(queryResponseHeader);
-        if (columnDescriptions.isEmpty() || packet.isBinaryRowData()) {
+        if (packet.isBinaryRowData()) {
             return Optional.empty();
         }
         responseType = ResponseType.QUERY;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutorTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutorTest.java
index 33c1441..fa7ac01 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutorTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutorTest.java
@@ -85,9 +85,11 @@ public final class PostgreSQLComBindExecutorTest {
         PostgreSQLComBindExecutor executor = new 
PostgreSQLComBindExecutor(bindPacket, backendConnection);
         setMockFieldIntoExecutor(executor);
         Collection<DatabasePacket<?>> actual = executor.execute();
-        assertThat(actual.size(), is(1));
-        assertThat(actual.iterator().next(), 
is(instanceOf(PostgreSQLBindCompletePacket.class)));
-        assertNull(executor.getResponseType());
+        assertThat(actual.size(), is(2));
+        Iterator<DatabasePacket<?>> actualPackets = actual.iterator();
+        assertThat(actualPackets.next(), 
is(instanceOf(PostgreSQLBindCompletePacket.class)));
+        assertThat(actualPackets.next(), 
is(instanceOf(PostgreSQLRowDescriptionPacket.class)));
+        assertThat(executor.getResponseType(), is(ResponseType.QUERY));
         verify(queryResponseHeader).getQueryHeaders();
     }
     

Reply via email to