Skip to content

Double variable casting in SQL statements #402

Answered by lovasoa
pchemguy asked this question in Q&A
Discussion options

You must be logged in to vote

Hi !
This is a good question. When binding variables, we use casting to let the engine know the expected type of the expression in the prepared statement. We could remove the casting when there is another cast, that would make the generated sql look slightly better, but this has simply never been implemented.

Can I avoid implicit casting CAST(? AS TEXT)?

Currently, you can't. Has it caused issues for you ? Or did you find it confusing when debugging ?

Do you provide a means to see submitted SQL for debug purposes?

Yes ! You can enable verbose logging by setting the environment variable RUST_LOG=sqlpage=debug

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by pchemguy
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants