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

wuweijie 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 3714873  Fix IllegalArgumentException when execute SELECT * FROM 
pg_catalog.pg_database statement with datagrip (#16519)
3714873 is described below

commit 37148737404ddbf49962cf21b7f01bf9ad7c8094
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Thu Mar 31 17:58:56 2022 +0800

    Fix IllegalArgumentException when execute SELECT * FROM 
pg_catalog.pg_database statement with datagrip (#16519)
---
 .../packet/command/query/extended/PostgreSQLColumnType.java         | 1 +
 .../db/protocol/postgresql/constant/PostgreSQLColumnTypeTest.java   | 6 ++++++
 .../infra/metadata/schema/builder/SystemSchemaBuilderRule.java      | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java
 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java
index 0f62c74..4570310 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java
+++ 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java
@@ -173,6 +173,7 @@ public enum PostgreSQLColumnType implements 
BinaryColumnType {
         JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.TIMESTAMP, 
POSTGRESQL_TYPE_TIMESTAMP);
         JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.OTHER, POSTGRESQL_TYPE_JSON);
         JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.SQLXML, POSTGRESQL_TYPE_XML);
+        JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BOOLEAN, POSTGRESQL_TYPE_BOOL);
     }
     
     /**
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLColumnTypeTest.java
 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLColumnTypeTest.java
index e639a88..d7d6b92 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLColumnTypeTest.java
+++ 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLColumnTypeTest.java
@@ -33,6 +33,12 @@ public final class PostgreSQLColumnTypeTest {
         assertThat(sqlColumnType, 
is(PostgreSQLColumnType.POSTGRESQL_TYPE_INT8));
     }
     
+    @Test
+    public void assertValueOfJDBCTypeForBooleanType() {
+        PostgreSQLColumnType sqlColumnType = 
PostgreSQLColumnType.valueOfJDBCType(Types.BOOLEAN);
+        assertThat(sqlColumnType, 
is(PostgreSQLColumnType.POSTGRESQL_TYPE_BOOL));
+    }
+    
     @Test(expected = IllegalArgumentException.class)
     public void assertValueOfJDBCTypeExThrown() {
         PostgreSQLColumnType.valueOfJDBCType(Types.REF_CURSOR);
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRule.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRule.java
index 462992a..42bbdbb 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRule.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRule.java
@@ -44,7 +44,7 @@ public enum SystemSchemaBuilderRule {
     
     POSTGRESQL_PG_CATALOG("PostgreSQL", "pg_catalog", 
Sets.newHashSet("pg_database", "pg_tablespace"));
     
-    private static final Map<String, SystemSchemaBuilderRule> 
SCHEMA_PATH_SYSTEM_SCHEMA_BUILDER_RULE_MAP = new HashMap<>();
+    private static final Map<String, SystemSchemaBuilderRule> 
SCHEMA_PATH_SYSTEM_SCHEMA_BUILDER_RULE_MAP = new HashMap<>(values().length, 1);
     
     private final String databaseType;
     

Reply via email to