Skip to content
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

Use ':' (colon) for substitution and cast operator together #309

Merged
merged 1 commit into from Feb 27, 2024

Conversation

xvrh
Copy link
Contributor

@xvrh xvrh commented Feb 27, 2024

I would like to use named parameters like this: :param. (mainly because it works so well in jetbrains IDEs).

It works with simple queries:

Sql.named('select * from device where id=:id', substitution: ':')

The problem is the sql parser chokes when we also use the postgres cast operator ::

select name::text from device where id=:id

This PR tries to handle the cast operator in the tokenizer. Let me know if this approach is ok and if you can think of more tests.

@isoos isoos merged commit e70208d into isoos:master Feb 27, 2024
1 check passed
@isoos
Copy link
Owner

isoos commented Feb 27, 2024

Thanks! Is there anything else you'd like to add, or should I release a new version?

@xvrh xvrh deleted the xha/substitution_colon_with_cast_operator branch February 27, 2024 15:04
@xvrh
Copy link
Contributor Author

xvrh commented Feb 27, 2024

Thanks a lot for the merge @isoos. I don't have anything else planned, you can release whenever you have time :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants