Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: value type decimal doesn't match type float #81858

Closed
maesenka opened this issue May 25, 2022 · 2 comments
Closed

sql: value type decimal doesn't match type float #81858

maesenka opened this issue May 25, 2022 · 2 comments
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community X-blathers-triaged blathers was able to find an owner

Comments

@maesenka
Copy link

maesenka commented May 25, 2022

Describe the problem

This came up in the Hibernate ORM tests. A SQL like this:

with HTE_Human (id, bodyWeight, heightInches) as (select (c1_0.mammal * 10), c1_1.body_weight, 180.0
                                                  from Cat c1_0
                                                           join Animal c1_1 on c1_0.mammal = c1_1.id),
     dml_cte_Animal (id)
         as (insert into Animal (id, body_weight) select e.id, e.bodyWeight from HTE_Human e returning id),
     dml_cte_Mammal (id) as (insert into Mammal (animal) select e.id from HTE_Human e returning animal),
     dml_cte_Human (id)
         as (insert into Human (mammal, height_centimeters) select e.id, e.heightInches from HTE_Human e returning mammal)
select count(*)
from dml_cte_Animal id;

throws the error: [42804] ERROR: value type decimal doesn't match type float of column "height_centimeters"

To Reproduce

See above

Expected behavior
As in Postgresql, automatic type conversion between compatible types.

Environment:

  • CockroachDB version 20.2.10
  • Server OS: Linux
  • Client app JDBC

This was submitted as part of work to fix the Hibernate ORM CI test suite for CockroachDB

Jira issue: CRDB-16096

@maesenka maesenka added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label May 25, 2022
@blathers-crl
Copy link

blathers-crl bot commented May 25, 2022

Hello, I am Blathers. I am here to help you get the issue triaged.

Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here.

I have CC'd a few people who may be able to assist you:

  • @cockroachdb/sql-experience (found keywords: ORM,ORM,Hibernate)

If we have not gotten back to your issue within a few business days, you can try the following:

  • Join our community slack channel and ask on #cockroachdb.
  • Try find someone from here if you know they worked closely on the area and CC them.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@blathers-crl blathers-crl bot added O-community Originated from the community X-blathers-triaged blathers was able to find an owner labels May 25, 2022
@otan
Copy link
Contributor

otan commented May 25, 2022

unfortunately this is a problem with "implicit casts" and is not something we support right now.

if you need an issue number to reference, it would be #75101. in the meantime, the only solution is to explicitly cast a type.

i am closing this as a duplicate

@otan otan closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community X-blathers-triaged blathers was able to find an owner
Projects
None yet
Development

No branches or pull requests

2 participants