IcebergXTY opened a new issue, #4655:
URL: https://github.com/apache/incubator-seatunnel/issues/4655

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   
   ### What happened
   
   we transfer data from mysql to postgresql, below is the table structure
   ```sql
   CREATE TABLE `field_deal_config` (
     `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
     `data_source_id` int NOT NULL,
     `field_pool_id` int NOT NULL,
     `save_to_field_pool_id` int DEFAULT NULL,
     PRIMARY KEY (`id`),
     KEY `idx_field_deal_config_data_source` (`data_source_id`)
   ) ENGINE=InnoDB AUTO_INCREMENT=751 DEFAULT CHARSET=utf8mb4 
COLLATE=utf8mb4_0900_ai_ci;
   ```
   As the `save_to_field_pool_id` can be null, so there are many null 
values.But when we begin transfer, seatunnel will use `getInt` to get value, 
then `save_to_field_pool_id` will not be null but 0 in postgresql.
   I'm not sure is this a bug, but in my opinion, null value in mysql should 
also be null in postgresql, right?😁
   
   ### SeaTunnel Version
   
   2.3.1
   
   ### SeaTunnel Config
   
   ```conf
   # mysql2pgsql_field_deal_config.conf
   env {
       execution {
           parallelism=1
       }
       job {
           mode=BATCH
       }
   }
   sink {
       jdbc {
           driver="org.postgresql.Driver"
           password="123"
           query="insert into 
field_deal_config(id,data_source_id,field_pool_id,save_to_field_pool_id) 
values(?,?,?,?)"
           url="jdbc:postgresql://127.0.0.1:5432/yqs?currentSchema=yqs_online"
           user=postgres
       }
   }
   source {
       jdbc {
           "connection_check_timeout_sec"=100
           driver="com.mysql.cj.jdbc.Driver"
           password="123"
           query="select id,data_source_id,field_pool_id,save_to_field_pool_id 
from field_deal_config"
           
url="jdbc:mysql://127.0.0.1:3307/yqs_online?serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&useLegacyDatetimeCode=false&useSSL=false&nullNamePatternMatchesAll=true&useUnicode=true&characterEncoding=UTF-8"
           user=root
       }
   }
   ```
   
   
   ### Running Command
   
   ```shell
   ./bin/seatunnel.sh --config ./template/mysql2pgsql_field_deal_config.conf -e 
local
   ```
   
   
   ### Error Exception
   
   ```log
   No error
   ```
   
   
   ### Flink or Spark Version
   
   _No response_
   
   ### Java or Scala Version
   
   _No response_
   
   ### Screenshots
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to