Skip to content

Support raw SQL / JSON-aware operators in table filters for json/jsonb columns #419

Description

@benedettoraviotta

Problem to solve

When filtering a table on a json / jsonb column from the table page, the operator dropdown only offers operators that are not contextual to JSON values:

  • Comparison: =, !=, >, >=, <, <=
  • Text Search: LIKE, ILIKE, NOT LIKE
  • List Operations: IN, NOT IN
  • Null Checks: IS NULL, IS NOT NULL

None of these let you address a key inside the JSON document, so the only workaround today is to drop into the SQL runner and write the query manually. This makes the table filter UI effectively unusable for json/jsonb columns.

Proposed solution

Either (or both) of the following:

  1. JSON-aware operators when the column is json/jsonb — expose contextual operators such as:

    • -> / ->> (get field / get field as text) with a key input
    • #> / #>> (get path) with a path input
    • @> / <@ (contains / contained by) with a JSON value input
    • ?, ?|, ?& (key / any keys / all keys exist)
    • Allow chaining (e.g. data->'meta'->>'status' = 'active')
  2. "Custom" / raw SQL operator — add a generic operator that lets the user type a raw SQL predicate fragment for the column (e.g. ->>'status' = 'active'), which gets appended to the WHERE clause as-is. This is also useful for any column type where the built-in operators are not enough (arrays, ranges, tsvector, custom types, etc.).

Option 2 is the cheapest to ship and unlocks every use case; option 1 is the more polished UX. Ideally both, with option 1 as sugar over option 2.

Alternative solutions or workarounds

Open the SQL runner and write the full query manually — works, but defeats the purpose of having a filter UI on the table page.

Additional context or links

Affects every table that stores structured data in jsonb (very common pattern in Postgres). Repro: open any table with a jsonb column, click the filter icon, pick the column → operator list shown in the screenshot.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions