You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/10/10 06:32:39 UTC

[GitHub] [shardingsphere] zxcvbnmzsedr opened a new issue, #20434: BLOB type not supported by PostgreSQL

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

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   
   ### Expected behavior
   I want to use ShardingSphere-JDBC to proxy Camunda.
   It was an unexpected discovery ,con‘t use postageSQL + Camunda 。
   
   ```
   insert into ACT_GE_BYTEARRAY(
           ID_,
           NAME_,
           BYTES_,
           DEPLOYMENT_ID_,
           GENERATED_,
           TENANT_ID_,
           TYPE_,
           CREATE_TIME_,
           REV_)
       values (
           #{id, jdbcType=VARCHAR},
           #{name, jdbcType=VARCHAR},
           #{bytes, jdbcType=BLOB},
           #{deploymentId, jdbcType=VARCHAR},
           #{generated, jdbcType=BOOLEAN},
           #{tenantId, jdbcType=VARCHAR},
           #{type, jdbcType=INTEGER},
           #{createTime, jdbcType=TIMESTAMP},
           1)
   ```
   
   ### Actual behavior
   
   ```
   org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of java.io.ByteArrayInputStream. Use setObject() with an explicit Types value to specify the type to use.
   ```
   <img width="1712" alt="image" src="https://user-images.githubusercontent.com/14026790/186049236-a804c857-38cb-441b-8c8b-e244ed0f223a.png">
   
   
   ### Reason analyze (If you can)
   AbstractPreparedStatementAdapter:289
   ```
   setParameterMethodInvocations.add(preparedStatement -> preparedStatement.setObject(index, each));
   eche instanceof is InputStream
   ```
   <img width="1396" alt="image" src="https://user-images.githubusercontent.com/14026790/186053774-a346cad8-da79-40f5-825c-19514e83aa03.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).
   


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


[GitHub] [shardingsphere] github-actions[bot] commented on issue #20434: BLOB type not supported by PostgreSQL

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #20434:
URL: https://github.com/apache/shardingsphere/issues/20434#issuecomment-1272348760

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


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


[GitHub] [shardingsphere] TeslaCN commented on issue #20434: BLOB type not supported by PostgreSQL

Posted by "TeslaCN (via GitHub)" <gi...@apache.org>.
TeslaCN commented on issue #20434:
URL: https://github.com/apache/shardingsphere/issues/20434#issuecomment-1409898839

   Is it possible to use `byte[]` instead of `ByteArrayInputStream`?


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


[GitHub] [shardingsphere] zxcvbnmzsedr commented on issue #20434: BLOB type not supported by PostgreSQL

Posted by GitBox <gi...@apache.org>.
zxcvbnmzsedr commented on issue #20434:
URL: https://github.com/apache/shardingsphere/issues/20434#issuecomment-1223450553

   I find this issues #14
   
   Does PostagesQL not consider the InputStream type?
   
   ```
   public void setObject(@Positive int parameterIndex, @Nullable Object x) throws SQLException {
       checkClosed();
       if (x == null) {
         setNull(parameterIndex, Types.OTHER);
       } else if (x instanceof UUID && connection.haveMinimumServerVersion(ServerVersion.v8_3)) {
         setUuid(parameterIndex, (UUID) x);
       } else if (x instanceof SQLXML) {
         setSQLXML(parameterIndex, (SQLXML) x);
       } else if (x instanceof String) {
         setString(parameterIndex, (String) x);
       } else if (x instanceof BigDecimal) {
         setBigDecimal(parameterIndex, (BigDecimal) x);
       } else if (x instanceof Short) {
         setShort(parameterIndex, (Short) x);
       } else if (x instanceof Integer) {
         setInt(parameterIndex, (Integer) x);
       } else if (x instanceof Long) {
         setLong(parameterIndex, (Long) x);
       } else if (x instanceof Float) {
         setFloat(parameterIndex, (Float) x);
       } else if (x instanceof Double) {
         setDouble(parameterIndex, (Double) x);
       } else if (x instanceof byte[]) {
         setBytes(parameterIndex, (byte[]) x);
       } else if (x instanceof ByteStreamWriter) {
         setByteStreamWriter(parameterIndex, (ByteStreamWriter) x);
       } else if (x instanceof java.sql.Date) {
         setDate(parameterIndex, (java.sql.Date) x);
       } else if (x instanceof Time) {
         setTime(parameterIndex, (Time) x);
       } else if (x instanceof Timestamp) {
         setTimestamp(parameterIndex, (Timestamp) x);
       } else if (x instanceof Boolean) {
         setBoolean(parameterIndex, (Boolean) x);
       } else if (x instanceof Byte) {
         setByte(parameterIndex, (Byte) x);
       } else if (x instanceof Blob) {
         setBlob(parameterIndex, (Blob) x);
       } else if (x instanceof Clob) {
         setClob(parameterIndex, (Clob) x);
       } else if (x instanceof Array) {
         setArray(parameterIndex, (Array) x);
       } else if (x instanceof PGobject) {
         setPGobject(parameterIndex, (PGobject) x);
       } else if (x instanceof Character) {
         setString(parameterIndex, ((Character) x).toString());
       } else if (x instanceof LocalDate) {
         setDate(parameterIndex, (LocalDate) x);
       } else if (x instanceof LocalTime) {
         setTime(parameterIndex, (LocalTime) x);
       } else if (x instanceof OffsetTime) {
         setTime(parameterIndex, (OffsetTime) x);
       } else if (x instanceof LocalDateTime) {
         setTimestamp(parameterIndex, (LocalDateTime) x);
       } else if (x instanceof OffsetDateTime) {
         setTimestamp(parameterIndex, (OffsetDateTime) x);
       } else if (x instanceof Map) {
         setMap(parameterIndex, (Map<?, ?>) x);
       } else if (x instanceof Number) {
         setNumber(parameterIndex, (Number) x);
       } else if (x.getClass().isArray()) {
         try {
           setObjectArray(parameterIndex, x);
         } catch (Exception e) {
           throw new PSQLException(
               GT.tr("Cannot cast an instance of {0} to type {1}", x.getClass().getName(), "Types.ARRAY"),
               PSQLState.INVALID_PARAMETER_TYPE, e);
         }
       } else {
         // Can't infer a type.
         throw new PSQLException(GT.tr(
             "Can''t infer the SQL type to use for an instance of {0}. Use setObject() with an explicit Types value to specify the type to use.",
             x.getClass().getName()), PSQLState.INVALID_PARAMETER_TYPE);
       }
     }
   ```


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


[GitHub] [shardingsphere] github-actions[bot] closed issue #20434: BLOB type not supported by PostgreSQL

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #20434: BLOB type not supported by PostgreSQL
URL: https://github.com/apache/shardingsphere/issues/20434


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