Skip to content

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
@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.

2 participants