[ 
https://issues.apache.org/jira/browse/OPENJPA-2966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18106332#comment-18106332
 ] 

Maxim Solodovnik commented on OPENJPA-2966:
-------------------------------------------


weird enough: {{CAST(-9 AS BIGINT)}} is invalid statement for MariaDB/MySQL
the correct expression is {{CAST(-9 as SIGNED INTEGER)}}

same time {{SIGNED INTEGER}} can't be used in column type while creating a 
table ....

I'm afraid I need some advise on this :(

[~cristof] [~rzo1] maybe you can advice? :)

> Long cast uses decimalTypeName instead of bigint
> ------------------------------------------------
>
>                 Key: OPENJPA-2966
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2966
>             Project: OpenJPA
>          Issue Type: Sub-task
>          Components: jpa
>    Affects Versions: 4.2.0
>            Reporter: Maxim Solodovnik
>            Assignee: Maxim Solodovnik
>            Priority: Major
>             Fix For: 4.2.0
>
>
> Discussion thread: 
> https://github.com/apache/openjpa/pull/144#discussion_r3683002577
> **(medium)** Casting to Long uses {{dict.decimalTypeName}}; on MySQL {{CAST(x 
> AS DECIMAL)}} defaults to DECIMAL(10,0), so large long values 
> overflow/truncate - why not {{bigintTypeName}} for the long case? 
> Also {{getDbNumberTargetTypeName}} sanitizes the {{{0}}} size suffix while 
> the sibling {{TypecastAsString.java:152}} appends {{dict.varcharTypeName}} 
> raw - the two siblings should share the same sanitize logic.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to