-
Notifications
You must be signed in to change notification settings - Fork 88
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
Cryptic error when passing int literals to foreign key columns in create #426
Comments
What's the error if you don't use |
Did not know that feature existed. If I change the id columns to both be Int32, the same error occurs (it still expected So it's a type error. Can this not be caught at compile time? Also curious why it thinks it got |
Oh, I see why it isn't caught at compile time. In I wonder if there's a better way to implement that. It also must be why it doesn't error when you pass nonexistent fields to |
I see what caused the error to be so cryptic. |
I've run into this issue when using other ORMs too, it's an inconvenience of the language by default having numbers be You'd have to do something like There are some types like this that just feel like they should be detected and then properly cast to the right type without having to specify it everywhere in the code base. |
The above works fine. But if I switch
u.id
for a literal number on the last line, even if it's the correct number, I get:I was very confused by this.
The text was updated successfully, but these errors were encountered: