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

zhonghongsheng 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 78e259f  Fix PostgreSQL 14 money data type are abnormal during full 
migration (#14767)
78e259f is described below

commit 78e259f598da09c612461b76b78c042aaf247072
Author: ReyYang <[email protected]>
AuthorDate: Fri Jan 14 16:30:00 2022 +0800

    Fix PostgreSQL 14 money data type are abnormal during full migration 
(#14767)
---
 .../postgresql/ingest/PostgreSQLInventoryDumper.java       | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/PostgreSQLInventoryDumper.java
 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/PostgreSQLInventoryDumper.java
index c680011..7a0fd6f 100644
--- 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/PostgreSQLInventoryDumper.java
+++ 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/PostgreSQLInventoryDumper.java
@@ -31,6 +31,8 @@ import java.sql.SQLException;
  */
 public final class PostgreSQLInventoryDumper extends AbstractInventoryDumper {
     
+    private static final String PG_MONEY_TYPE = "money";
+    
     public PostgreSQLInventoryDumper(final InventoryDumperConfiguration 
inventoryDumperConfig, final PipelineDataSourceManager dataSourceManager) {
         super(inventoryDumperConfig, dataSourceManager);
     }
@@ -41,4 +43,16 @@ public final class PostgreSQLInventoryDumper extends 
AbstractInventoryDumper {
         result.setFetchSize(1);
         return result;
     }
+    
+    @Override
+    protected Object readValue(final ResultSet resultSet, final int index) 
throws SQLException {
+        if (isPgMoneyType(resultSet, index)) {
+            return resultSet.getBigDecimal(index);
+        }
+        return resultSet.getObject(index);
+    }
+    
+    private boolean isPgMoneyType(final ResultSet resultSet, final int index) 
throws SQLException {
+        return 
PG_MONEY_TYPE.equalsIgnoreCase(resultSet.getMetaData().getColumnTypeName(index));
+    }
 }

Reply via email to