Unexpected data type when conditionally updating column #1790
-
I've written a function in my updateStatus: UPDATE my_table SET status = MAX(status, :newStatus), second_col = :secondCol; and generate my function, it thinks CREATE TABLE my_table (
...
status INT NULL
); IDE error message: And indeed when I look in the generated code, it has set the type to String: variables: [
Variable<String>(newStatus),
...
] |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You need to give updateStatus(:newStatus AS INT):
UPDATE my_table SET status = MAX(status, :newStatus), second_col = :secondCol; https://drift.simonbinder.eu/docs/using-sql/drift_files/#variables |
Beta Was this translation helpful? Give feedback.
You need to give
:newStatus
a type as it seems its not inferred.https://drift.simonbinder.eu/docs/using-sql/drift_files/#variables