MrCong233 opened a new issue, #22205:
URL: https://github.com/apache/shardingsphere/issues/22205

   ## Bug Report
   
   Using grafana connects to shardingsphere, openGauss report :column 
"auth_token_seen" is of type boolean but expression is of type character 
varying.
   
   ### Which version of ShardingSphere did you use?
   
   shardingsphere-5.2.1, commit id:85541320133e8049027e922557636fe32c58625c
   
   grafana-7.1.3 with opengauss-gdbc
   
   openGauss-3.1.0,create a MySQL compatible database(create database 
DBCOMPATIBILITY='B';)
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   proxy
   
   ### Expected behavior
   
   log in successfully.
   
   ### Actual behavior
   
   
![image-20221115205253065-1668588227340-6](https://user-images.githubusercontent.com/27768675/202133533-397dafe5-d003-4485-a04a-81cb599dd885.png)
   
   
   ### Reason analyze (If you can)
   
   The problem is initially positioned as that in the preparestatment of 
shardingsphere to openGauss, the expected bool field is actually passed to 
varchar.
   
   the error sql of preparedstatement
   
   ```
    INSERT INTO "user_auth_token" 
("user_id","auth_token","prev_auth_token","user_agent","client_ip","auth_token_seen","seen_at","rotated_at","created_at","updated_at")
 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING "id";
   ```
   
   the complate sql
   
   ```
   INSERT INTO "user_auth_token" 
("user_id","auth_token","prev_auth_token","user_agent","client_ip","auth_token_seen","seen_at","rotated_at","created_at","updated_at")
 VALUES ('1', 
'af6ae41531d013b0034c0f9b52c8c22ccd218ae1a4821f1827adce9717170061', 
'af6ae41531d013b0034c0f9b52c8c22ccd218ae1a4821f1827adce9717170061', 
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like 
Gecko) Chrome/107.0.0.0 Safari/537.36', '192.168.0.28', 'false', '0', 
'1668518543', '1668518543', '1668518543') RETURNING "id"
   ```
   
![image-20221115212342258-1668588230582-8](https://user-images.githubusercontent.com/27768675/202133654-a398632f-4177-4884-9f8f-07fdc9c0c3db.png)
   
   Before shardingsphere sends the message to openGauss, the data type of the 
error column is 1043 which means varchar.
   
   
![image-20221116151442487-1668588232549-10](https://user-images.githubusercontent.com/27768675/202133737-b7ba096c-076c-4964-9d4e-de50114899cb.png)
   
   When shardingsphere receives a message, the data type of the error column is 
POSTGRESQL_TYPE_BIT.
   
![image-20221116161457325-1668588234302-12](https://user-images.githubusercontent.com/27768675/202133885-ecba98ad-723a-40ee-b435-b2ea38541b75.png)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   
   the detail of table
   
![QQ截图20221116153241-1668588236686-14](https://user-images.githubusercontent.com/27768675/202133943-68e46d8e-bffe-481d-92be-6d449af09f9c.png)
   
   ```yaml
   rules:
     - !AUTHORITY
       users:
         - root@%:root
         - sharding@:sharding
       provider:
         type: ALL_PRIVILEGES_PERMITTED
     - !TRANSACTION
       defaultType: local
       providerType: Atomikos
       #providerType: Narayana
   props:
     max-connections-size-per-query: 1
     executor-size: 16  # Infinite by default.
     sql-show: true
     proxy-frontend-flush-threshold: 128  # The default value is 128.
     proxy.transaction.type: XA
     sql-federation-type: ADVANCED
     
   ```
   
   
   
   ```yaml
   databaseName: grafana
   
   dataSources:
     ds_0:
       url: 
jdbc:opengauss://192.168.0.129:56666/grafana?serverTimezone=UTC&useSSL=false&connectTimeout=10&batchMode=on&loggerLevel=OFF
       username: grafana
       password: Huawei@123
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   rules:
     - !SHARDING
       defaultDatabaseStrategy:
         standard:
           shardingAlgorithmName: database_default_inline
           shardingColumn: id
       #      none: null
       defaultTableStrategy:
         none: null
       shardingAlgorithms:
         database_default_inline:
           props:
             algorithm-expression: ds_0
           type: INLINE
         ds_t1_alg:
           props:
             algorithm-expression: ds_${ds_id % 1}
           type: INLINE
         ts_t1_alg:
           props:
             algorithm-expression: ts_${ts_id % 1}
           type: INLINE
       tables:
         t1:
           actualDataNodes: ds_${0..0}.ts_${0..0}
           databaseStrategy:
             standard:
               shardingAlgorithmName: ds_t1_alg
               shardingColumn: ds_id
           tableStrategy:
             standard:
               shardingAlgorithmName: ts_t1_alg
               shardingColumn: ts_id
   ```
   
   


-- 
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