sandynz opened a new issue #11899:
URL: https://github.com/apache/shardingsphere/issues/11899
## Bug Report
### Which version of ShardingSphere did you use?
5.0.0-RC1-SNAPSHOT
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Scaling, commit: d39fd2c4d1f21363c13c791dcb4df48808029da0
### Expected behavior
No exception thrown when executing ScalingJob for PostgreSQL
### Actual behavior
Stack trace:
```
o.a.s.e.e.h.g.LogJobErrorHandler - Job '634800837499027457' exception occur
in job processing
java.lang.RuntimeException: Load metaData for table t_order_0 failed
at
org.apache.shardingsphere.scaling.core.common.datasource.MetaDataManager.getTableMetaData(MetaDataManager.java:51)
at
org.apache.shardingsphere.scaling.core.job.preparer.splitter.InventoryTaskSplitter.isSpiltByPrimaryKeyRange(InventoryTaskSplitter.java:129)
at
org.apache.shardingsphere.scaling.core.job.preparer.splitter.InventoryTaskSplitter.getInventoryPositions(InventoryTaskSplitter.java:120)
at
org.apache.shardingsphere.scaling.core.job.preparer.splitter.InventoryTaskSplitter.splitByPrimaryKey(InventoryTaskSplitter.java:95)
at
org.apache.shardingsphere.scaling.core.job.preparer.splitter.InventoryTaskSplitter.splitDumperConfig(InventoryTaskSplitter.java:76)
at
org.apache.shardingsphere.scaling.core.job.preparer.splitter.InventoryTaskSplitter.splitInventoryData(InventoryTaskSplitter.java:64)
at
org.apache.shardingsphere.scaling.core.job.preparer.ScalingJobPreparer.initInventoryTasks(ScalingJobPreparer.java:84)
at
org.apache.shardingsphere.scaling.core.job.preparer.ScalingJobPreparer.prepare(ScalingJobPreparer.java:55)
at
org.apache.shardingsphere.scaling.core.job.ScalingJob.execute(ScalingJob.java:47)
at
org.apache.shardingsphere.elasticjob.simple.executor.SimpleJobExecutor.process(SimpleJobExecutor.java:33)
at
org.apache.shardingsphere.elasticjob.simple.executor.SimpleJobExecutor.process(SimpleJobExecutor.java:29)
at
org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.process(ElasticJobExecutor.java:177)
at
org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.process(ElasticJobExecutor.java:147)
at
org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.execute(ElasticJobExecutor.java:130)
at
org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.execute(ElasticJobExecutor.java:106)
at
org.apache.shardingsphere.elasticjob.lite.internal.schedule.LiteJob.execute(LiteJob.java:35)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near
"`"
位置:15
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
at
org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
at
org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
at
org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:224)
at
com.zaxxer.hikari.pool.ProxyStatement.executeQuery(ProxyStatement.java:111)
at
com.zaxxer.hikari.pool.HikariProxyStatement.executeQuery(HikariProxyStatement.java)
at
org.apache.shardingsphere.infra.metadata.schema.builder.loader.ColumnMetaDataLoader.load(ColumnMetaDataLoader.java:79)
at
org.apache.shardingsphere.infra.metadata.schema.builder.loader.TableMetaDataLoader.load(TableMetaDataLoader.java:56)
at
org.apache.shardingsphere.scaling.core.common.datasource.MetaDataManager.getTableMetaData(MetaDataManager.java:49)
... 17 common frames omitted
```
### Reason analyze (If you can)
`ColumnMetaDataLoader.generateEmptyResultSQL(tableNamePattern,
databaseType)` return `SELECT * FROM `t_order_0` WHERE 1 != 1`. `databaseType`
parameter value is `MySQL`.
<img width="1113" alt="截屏2021-08-19 下午12 00 52"
src="https://user-images.githubusercontent.com/42492540/130017202-eb07be68-4fed-4b86-b9ad-08c0448c4c0f.png">
`MetaDataManager.getTableMetaData` hard coded `databaseType` as `MySQL`.
<img width="1098" alt="截屏2021-08-19 下午12 04 05"
src="https://user-images.githubusercontent.com/42492540/130017227-77bd2af2-7fd0-45c9-b427-5ef024c02339.png">
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
Follow [Logical Decoding
Examples](https://www.postgresql.org/docs/current/logicaldecoding-example.html)
and [Scaling
Manual](https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-scaling/usage/)
### 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]