shardingsphere
shardingsphere copied to clipboard
PostgreSQL 14 bit, varbit, and money data type are abnormal during full migration
Which version of ShardingSphere did you use?
master branch PostgreSQL 14
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
Sharding-scaling
Expected behavior
Migration succeeded
Actual behavior
PostgreSQL 14 bit, varbit, and money data type are abnormal during full migration
Reason analyze (If you can)
The Java type detected by the source is inconsistent with the data type to be inserted
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
- create table
create table table_mix
(
id bigint primary key,
shard_id bigint not null,
t_bit bit null,
t_varbit varbit null,
t_money money null
);
- start scaling ALTER SHARDING TABLE RULE table_mix ( RESOURCES(ds_2,ds_3), SHARDING_COLUMN=id, TYPE(NAME=HASH_MOD,PROPERTIES("sharding-count"=2)), GENERATED_KEY(COLUMN=id,TYPE(NAME=snowflake,PROPERTIES("worker-id"=123))) );
- throw exception
[ERROR] 2022-01-13 14:04:24.393 [ShardingSphere-Scaling-execute-0] o.a.s.d.p.c.i.AbstractImporter - flush failed 3/3 times.
java.sql.BatchUpdateException: Batch entry 0 INSERT INTO "table_mix_1"("id","shard_id","t_bigint","t_bigserial","t_bit","t_bit_var","t_bool","t_bytea","t_chat","t_varchar","t_date","t_float","t_int","t_json","t_jsonb","t_money","t_decimal","t_real","t_int2","t_serial2","t_serial4","t_text","t_time","t_timez","t_timestmap","t_timestampz","t_xml") VALUES(1, 2, 1, 1, 'TRUE', '1', 'TRUE', ?, '1', '123', '1997-10-13 +08', 0.5, 1, '{
"yang": 123
}', '{"yang": 123}', 100.0, '10.12', 1.0, 1, 1, 1, 'texttexttext', '01:00:00+08', '18:00:00+08', '1999-01-08 00:00:00+08', '1999-01-08 00:00:00+08', '<book><title>Manual</title><chapter>...</chapter></book>') ON CONFLICT (id) DO NOTHING was aborted: ERROR: column "t_bit" is of type bit but expression is of type boolean
建议:You will need to rewrite or cast the expression.
位置:327 Call getNextException to see other errors in the batch.
at org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:148)
at org.postgresql.core.ResultHandlerDelegate.handleError(ResultHandlerDelegate.java:50)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2184)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:481)
at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:840)
at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1538)
at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
at org.apache.shardingsphere.driver.executor.batch.BatchPreparedStatementExecutor$1.executeSQL(BatchPreparedStatementExecutor.java:143)
at org.apache.shardingsphere.driver.executor.batch.BatchPreparedStatementExecutor$1.executeSQL(BatchPreparedStatementExecutor.java:139)
at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:85)
at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:64)
at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.syncExecute(ExecutorEngine.java:101)
at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.serialExecute(ExecutorEngine.java:87)
at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.execute(ExecutorEngine.java:81)
at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:65)
at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:49)
at org.apache.shardingsphere.driver.executor.batch.BatchPreparedStatementExecutor.executeBatch(BatchPreparedStatementExecutor.java:152)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.executeBatch(ShardingSpherePreparedStatement.java:501)
at org.apache.shardingsphere.data.pipeline.core.importer.AbstractImporter.executeBatchInsert(AbstractImporter.java:178)
at org.apache.shardingsphere.data.pipeline.core.importer.AbstractImporter.doFlush(AbstractImporter.java:153)
at org.apache.shardingsphere.data.pipeline.core.importer.AbstractImporter.tryFlush(AbstractImporter.java:138)
at org.apache.shardingsphere.data.pipeline.core.importer.AbstractImporter.flushInternal(AbstractImporter.java:129)
at org.apache.shardingsphere.data.pipeline.core.importer.AbstractImporter.lambda$flush$2(AbstractImporter.java:120)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.apache.shardingsphere.data.pipeline.core.importer.AbstractImporter.flush(AbstractImporter.java:115)
at org.apache.shardingsphere.data.pipeline.core.importer.AbstractImporter.write(AbstractImporter.java:97)
at org.apache.shardingsphere.data.pipeline.core.importer.AbstractImporter.start(AbstractImporter.java:86)
at org.apache.shardingsphere.data.pipeline.api.executor.AbstractLifecycleExecutor.run(AbstractLifecycleExecutor.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.postgresql.util.PSQLException: ERROR: column "t_bit" is of type bit but expression is of type boolean
建议:You will need to rewrite or cast the expression.
位置:327
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
... 33 common frames omitted
Example codes for reproduce this issue (such as a github link).
can i take it? thx