-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Setup
Versions
- Rust: any
- Diesel: any
- Database: any
- Operating System any
Feature Flags
- diesel:
Problem Description
Parenthesis inserted in Rust to override order of operations are lost in the generated SQL. This can also occur when a value is assigned to a local variable. This will at best result in an incorrect value being generated, and at worst will result in a runtime error because of incorrect types (e.g. interval * (integer - integer)
is valid but interval * integer - integer
is not)
What is the expected output?
14
What is the actual output?
10
Steps to reproduce
fn test(conn: &Connection) {
let x = select(2.into_sql::<Integer>() * (3.into_sql::<Integer>() + 4))
.get_result(conn);
assert_eq!(Ok(14), x);
}
Checklist
- I have already looked over the issue tracker for similar issues.
- This issue can be reproduced on Rust's stable channel. (Your issue will be
closed if this is not the case)
Metadata
Metadata
Assignees
Labels
No labels