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

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   master - 70c02a332868c971e34a326995bb8f9a100d5f35
   
   This may affect all versions <= 5.3.1.
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy PostgreSQL
   
   ### Expected behavior
   
   Insert succeeded.
   
   ### Actual behavior
   
   Client log:
   ```
   Exception in thread "main" org.postgresql.util.PSQLException: ERROR: Cannot 
find PostgreSQL type 'POSTGRESQL_TYPE_BYTEA' in column type when process binary 
protocol value
        at 
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2675)
        at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2365)
        at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:355)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:490)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:408)
        at 
org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:166)
        at 
org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:134)
   ```
   
   Proxy log:
   ```
   [ERROR] 2023-01-28 16:07:21.825 [Connection-17-ThreadExecutor] 
o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.IllegalArgumentException: Cannot find PostgreSQL type 
'POSTGRESQL_TYPE_BYTEA' in column type when process binary protocol value
        at 
com.google.common.base.Preconditions.checkArgument(Preconditions.java:217)
        at 
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol.PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLBinaryProtocolValueFactory.java:145)
        at 
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.PostgreSQLComBindPacket.getBinaryParameters(PostgreSQLComBindPacket.java:140)
        at 
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.PostgreSQLComBindPacket.readParameters(PostgreSQLComBindPacket.java:81)
        at 
org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.bind.PostgreSQLComBindExecutor.execute(PostgreSQLComBindExecutor.java:51)
        at 
org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.PostgreSQLAggregatedCommandExecutor.execute(PostgreSQLAggregatedCommandExecutor.java:41)
        at 
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:110)
        at 
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:77)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
   ```
   
   ### Example codes for reproduce this issue (such as a github link).
   
   ```java
   try (Statement statement = connection.createStatement()) {
       statement.executeUpdate("drop table if exists json_pg");
       statement.executeUpdate("create table json_pg (val_jsonb jsonb not 
null)");
   }
   try (PreparedStatement preparedStatement = 
connection.prepareStatement("insert into json_pg values (?)")) {
       preparedStatement.setBytes(1, 
"{\"test\":\"test\"}".getBytes(StandardCharsets.UTF_8));
       System.out.println(preparedStatement.executeUpdate());
   }
   ```


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