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

Support for more JSONB operators for Postgres #10138

Open
vijayprasanna13 opened this issue Feb 21, 2024 · 2 comments
Open

Support for more JSONB operators for Postgres #10138

vijayprasanna13 opened this issue Feb 21, 2024 · 2 comments
Labels
c/server Related to server k/enhancement New feature or improve an existing feature

Comments

@vijayprasanna13
Copy link
Member

Description

Currently, the documentation for JSONB column operators has support for only _contains, _contained_in, _has_key, _has_keys_any and _has_keys_all.
However, in PostgreSQL, we can execute queries using operators such as >, <, =, among others, as illustrated in the example below:

select * from service_item_instances where (custom_data ->> 'screen_size')::int > 30;

The documented operators might not suffice for operations like >, <, =, and similar comparisons.

@vijayprasanna13 vijayprasanna13 added k/enhancement New feature or improve an existing feature c/server Related to server labels Feb 21, 2024
@anish-pr
Copy link

@vijayprasanna13 @SamirTalwar Any updates on this? whether it will come in future or cant be done?

@SamirTalwar
Copy link
Contributor

Hey @anish-pr, thanks for pinging me.

Currently, we don't support this kind of composition over JSONB columns, and doing so would require a significant modification to our GraphQL syntax and schema. There are no plans to make changes to this in Hasura v2. We plan on providing much greater support for JSONB columns with v3, but it won't be in the first batch of functionality.

We suggest you use one of two features to accomplish this.

  1. Computed fields will allow you to transform the JSONB column so that you can work with it.
  2. Native queries let you write your own SQL and then automatically convert it into a GraphQL structure for you.

Hopefully one of those suits your needs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/server Related to server k/enhancement New feature or improve an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants