kyle306 opened a new issue, #28324:
URL: https://github.com/apache/shardingsphere/issues/28324
## Bug Report
### Which version of ShardingSphere did you use?
5.4.0
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
### Other versions
PostgreSQL 14.9
MacOS 13.5.1
### Expected behavior
Get correct definition of the table and create sharding tables accordingly.
### Actual behavior
Failed to parse value of the max number of sequence of the table due to the
format of 'seqmax', and threw the exception.
But if the sequence is not binding with the column and the application
assigns the value for the column when inserting, ShardingSphere-Proxy worked
fine.
### Reason analyze (If you can)
When the freemarker gets the string form (eg. '2,147,483,647') of max value
(eg. 2147483647) of sequence setting, it failed to convert it to number for
future usage.
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
#### Table SQL
CREATE TABLE IF NOT EXISTS public.students
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1
MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
full_name character varying COLLATE pg_catalog."default",
home_address character varying COLLATE pg_catalog."default",
CONSTRAINT students_pkey PRIMARY KEY (id)
)
#### Properties of the database
ENCODING = 'UTF8'
LC_COLLATE = 'zh_CN.UTF-8'
LC_CTYPE = 'zh_CN.UTF-8'
### Stack trace
[ERROR] 2023-08-31 17:39:32.799
[j0102p0000ad58d1e2513d628762803c266f7aba89_Worker-1]
o.a.s.e.e.h.g.LogJobErrorHandler - Job
'j0102p0000ad58d1e2513d628762803c266f7aba89' exception occur in job processing
freemarker.core.NonNumericalException: Can't convert this string to number:
"2,147,483,647"
The blamed expression:
==> c.seqmax?number [in template "component/table/12_plus/create.ftl" at
line 50, column 47]
----
FTL stack trace ("~" means nesting-related):
- Failed at: #if c.seqmax?? && c.seqmax?number gt -1 [in template
"component/table/12_plus/create.ftl" at line 50, column 28]
----
at
freemarker.core.NonNumericalException.newMalformedNumberException(NonNumericalException.java:70)
at
freemarker.core.BuiltInsForStringsMisc$numberBI.calculateResult(BuiltInsForStringsMisc.java:138)
at freemarker.core.BuiltInForString._eval(BuiltInForString.java:29)
at freemarker.core.Expression.eval(Expression.java:101)
at freemarker.core.EvalUtil.compare(EvalUtil.java:113)
at
freemarker.core.ComparisonExpression.evalToBoolean(ComparisonExpression.java:78)
at freemarker.core.AndExpression.evalToBoolean(AndExpression.java:36)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:48)
at freemarker.core.Environment.visit(Environment.java:347)
at freemarker.core.Environment.visit(Environment.java:353)
at freemarker.core.Environment.visit(Environment.java:389)
at
freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:291)
at
freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271)
at
freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:244)
at freemarker.core.Environment.visitIteratorBlock(Environment.java:657)
at
freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:108)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94)
at freemarker.core.Environment.visit(Environment.java:347)
at freemarker.core.Environment.visit(Environment.java:353)
at freemarker.core.Environment.visit(Environment.java:353)
at freemarker.core.Environment.process(Environment.java:326)
at freemarker.template.Template.process(Template.java:383)
at
org.apache.shardingsphere.data.pipeline.postgresql.util.PostgreSQLPipelineFreemarkerManager.getSQLByVersion(PostgreSQLPipelineFreemarkerManager.java:77)
at
org.apache.shardingsphere.data.pipeline.postgresql.ddlgenerator.PostgreSQLCreateTableSQLGenerator.generateCreateTableSQL(PostgreSQLCreateTableSQLGenerator.java:60)
at
org.apache.shardingsphere.data.pipeline.postgresql.ddlgenerator.PostgreSQLCreateTableSQLGenerator.generate(PostgreSQLCreateTableSQLGenerator.java:44)
at
org.apache.shardingsphere.data.pipeline.common.metadata.generator.PipelineDDLGenerator.generateLogicDDL(PipelineDDLGenerator.java:79)
at
org.apache.shardingsphere.data.pipeline.core.preparer.datasource.AbstractDataSourcePreparer.getCreateTargetTableSQL(AbstractDataSourcePreparer.java:123)
at
org.apache.shardingsphere.data.pipeline.postgresql.prepare.datasource.PostgreSQLDataSourcePreparer.prepareTargetTables(PostgreSQLDataSourcePreparer.java:40)
at
org.apache.shardingsphere.data.pipeline.core.preparer.PipelineJobPreparerUtils.prepareTargetTables(PipelineJobPreparerUtils.java:123)
at
org.apache.shardingsphere.data.pipeline.scenario.migration.prepare.MigrationJobPreparer.prepareTarget(MigrationJobPreparer.java:168)
at
org.apache.shardingsphere.data.pipeline.scenario.migration.prepare.MigrationJobPreparer.prepareAndCheckTarget(MigrationJobPreparer.java:148)
at
org.apache.shardingsphere.data.pipeline.scenario.migration.prepare.MigrationJobPreparer.prepareAndCheckTargetWithLock(MigrationJobPreparer.java:134)
at
org.apache.shardingsphere.data.pipeline.scenario.migration.prepare.MigrationJobPreparer.prepare(MigrationJobPreparer.java:99)
at
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJob.doPrepare(MigrationJob.java:75)
at
org.apache.shardingsphere.data.pipeline.core.job.AbstractPipelineJob.prepare(AbstractPipelineJob.java:91)
at
org.apache.shardingsphere.data.pipeline.core.job.AbstractSimplePipelineJob.execute0(AbstractSimplePipelineJob.java:70)
at
org.apache.shardingsphere.data.pipeline.core.job.AbstractSimplePipelineJob.execute(AbstractSimplePipelineJob.java:50)
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:173)
at
org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.process(ElasticJobExecutor.java:142)
at
org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.execute(ElasticJobExecutor.java:124)
at
org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.execute(ElasticJobExecutor.java:100)
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)
--
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]