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

In a jsonb column, how can I query with the "LIKE" upon the value if the value is a string? #24

Open
Adron opened this issue Mar 12, 2021 · 1 comment
Assignees
Labels
next-up-for-ama This question is next up for an AMA session. question Further information is requested

Comments

@Adron
Copy link
Contributor

Adron commented Mar 12, 2021

If I have a jsonb field/column, but the value is, in some cases, a string, e.g. "abc123". I'd like to be able to query that value with something like the "LIKE" query on it. From what I can find, this is supported by Postgres and requires you to basically cast the field/value as "text" and then you can do the "LIKE" query, see https://stackoverflow.com/a/57562423/1374827 for an example. For cases where the field value was not a string (e.g. it's a float, or array, or object), I wouldn't really care how Hasura behaved, although I would assume it would make sense that it would still cast the value as text and then attempt to perform a "LIKE" query on the result. The overall outcome that would be great is if like and _ilike were available as new options for the where parameter for jsonb fields/columns, i.e. if they were added to jsonb_comparison_exp. Will this be available in the future?

@Adron Adron added the question Further information is requested label Mar 12, 2021
@Adron Adron self-assigned this Mar 12, 2021
@jordanmkoncz
Copy link

Thanks @Adron. I originally asked about this on the Hasura Discord so if there are any questions about use cases or additional clarification needed, I'll be happy to answer :)

@Adron Adron added the next-up-for-ama This question is next up for an AMA session. label Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next-up-for-ama This question is next up for an AMA session. question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants