can't use interval #1421
Unanswered
antonio-antuan
asked this question in
Q&A
Replies: 1 comment
-
We usually leave it up to Postgres to infer the types of bind parameters and then tell us what it's expecting, but in cases like this, it fails to infer and falls back to the default type, You can hint at the type of the bind parameter in SQL by adding a cast, like so, and then this should compile: SELECT * FROM sources WHERE last_scrape_time < NOW() - $1::interval Converting this to a Q&A discussion since it doesn't really concern a bug in SQLx, it's just a limitation of our interface with Postgres and of proc macros (since we can't ask the compiler the type of the bind expression and tell Postgres what it is). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Greetings and thanks for your project.
Could you tell me how can I fix this error?
Beta Was this translation helpful? Give feedback.
All reactions