You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "RaigorJiang (via GitHub)" <gi...@apache.org> on 2024/09/13 03:56:25 UTC

[I] [PostgreSQL] ERROR: op ANY/ALL (array) requires array on right side [shardingsphere]

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

   ## Bug Report
   ### Which version of ShardingSphere did you use?
   5.5.1-SNAPSHOT master 40bc1ed3d80f4dfe4bbc2f9b69bafec6519f207b
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   
   ### Actual behavior
   <img width="1131" alt="image" src="https://github.com/user-attachments/assets/d0da0894-3cbc-417a-ac5d-b397440d11fc">
   
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   1. init table in pg
   ```sql
   CREATE TABLE member (
   mail_max_expire_at integer NOT NULL, 
   data bytea, 
   mid character varying(9) NOT NULL, 
   nickname character varying(63) NOT NULL
   );
   
   insert into member (mail_max_expire_at, data, mid, nickname)
   values (1, 'aa'::bytea, 'ABCDEFG89', 'anyone');
   
   insert into member (mail_max_expire_at, data, mid, nickname)
   values (2, 'abc'::bytea, 'ABCDEFG78', 'Sky');
   ```
   
   2. global config
   ```yaml
   props:
     proxy-frontend-database-protocol-type: PostgreSQL
     sql-show: true
   ```
   
   4. database config
   ```yaml
   databaseName: sharding_db
   
   dataSources:
    ds_0:
      url: jdbc:postgresql://127.0.0.1:5432/demo_ds_0
      username: postgres
      password: xxx
      connectionTimeoutMilliseconds: 30000
      idleTimeoutMilliseconds: 60000
      maxLifetimeMilliseconds: 1800000
      maxPoolSize: 10
      minPoolSize: 1
   rules:
     - !SINGLE
       tables:
         - "*.*.*"
   ```
   
   5. query from proxy
   ```java
   public static void main(String[] args) {
           HikariConfig config = new HikariConfig();
           config.setDriverClassName("org.postgresql.Driver");
           config.setJdbcUrl("jdbc:postgresql://localhost:3307/sharding_db");
           config.setUsername("root");
           config.setPassword("root");
   
           try (HikariDataSource hikari = new HikariDataSource(config);
                Connection connection = hikari.getConnection()) {
               PreparedStatement preparedStatement = connection.prepareStatement("SELECT mid, data, mail_max_expire_at, nickname FROM member WHERE mid = any(?);");
               Array array = connection.createArrayOf("varchar", new String[]{"ABCDEFG89"});
               preparedStatement.setArray(1, array);
               ResultSet resultSet = preparedStatement.executeQuery();
               while (resultSet.next()) {
                   System.out.println(resultSet.getString(1));
                   System.out.println(resultSet.getString(2));
                   System.out.println(resultSet.getString(3));
                   System.out.println(resultSet.getString(4));
               }
           } catch (SQLException e) {
               throw new RuntimeException(e);
           }
       }
   ```
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [PostgreSQL] ERROR: op ANY/ALL (array) requires array on right side [shardingsphere]

Posted by "jiangML (via GitHub)" <gi...@apache.org>.
jiangML closed issue #32843: [PostgreSQL] ERROR: op ANY/ALL (array) requires array on right side
URL: https://github.com/apache/shardingsphere/issues/32843


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org