Replies: 1 comment
-
|
@Kakadus Thanks for opening this. I converted this to a discussion as this is strictly speaking a feature request and not a bug. I agree that this would be good to have, but unfortunately I do not see an easy way to add this. The problem here is that we rely on rustc to resolve generic types for That written: I'm still open to suggestions how to implement this without breaking existing usages. Maybe a more flexible |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Rust Version
1.90.0 (1159e78c4 2025-09-14)
Diesel Version
2.3.2
Diesel Features
"numeric", "postgres"
Database Version
PostgreSQL 18
Operating System Version
Arch Linux
What happened?
First of all: Thanks for this awesome, well-maintained project.
Mathematical database operations between decimal and non-decimal column in a select block do not seem to be supported. The column types are not up/downcasted properly, and compilation fails.
See steps to reproduce for showcasing Numeric + Int4. Subtraction, multiplication, division etc follow analogous. Note that this is not dependent on the bigdecimal implementation, because these operations are performed in the database. No additional dependencies are needed.
PostgreSQL defines the type mappings here in their math docs.
What did you expect to happen?
I would expected diesel to support all mathematical operations which the underlying database supports.
Additional details
No response
Steps to reproduce
Compile time error
Checklist
I have already looked over the issue tracker and the discussion forum for similar possible closed issues.
This issue can be reproduced on Rust's stable channel. (Please submit the issue in the Rust issue tracker instead if that's not the case)
This issue can be reproduced without requiring a third party crate
Beta Was this translation helpful? Give feedback.
All reactions