-
Notifications
You must be signed in to change notification settings - Fork 3
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
Yeshql cannot handle :: cast in postgresql #7
Comments
You are right, this doesn't work - -- name: getMytable :: ()
-- :id :: Int
SELECT * FROM mytable WHERE id = :id ...you could also write: -- name: getMytable :: ()
SELECT * FROM mytable WHERE id = :id :: Int Both forms are equivalent, however, the first form allows you to order parameters independently from the order in which they are found inside the query. I'm not entirely sure how to fix this clash with PostgreSQL syntax; possibilities would include:
|
I think the second option balances things. I would have preferred the first one, but since this is a postgresql only syntax it'll be better to use an opt-out switch. The other two just bring complexity that'll be too much for a simple library |
Expected Behaviour
[yesh| -- name: getMytable :: () select *, now() - '1 hour ago'::interval from mytable; |]
should generate
Actual Behaviour
My guess is yeshql is detecting
::
in queries. I thought it would only use those in comments(--
)For now I am using
cast
directly.I would have liked to send a patch but I know close to nothing of neither
template-haskell
notQuasiQuoting
The text was updated successfully, but these errors were encountered: