Repository navigation
PostgREST JSONB Root Filter ilike #4986
Replies: 2 comments 5 replies
@voronczoff Can you elaborate on that? What error do you get? |
|
Until there's an operator for this, a computed field gets you there without adding a stored column. PostgREST lets you filter on a function that takes the row type as if it were a column: create function jsondata_text(events) returns text
language sql immutable as $$
select $1.jsondata::text -- same as jsondata #>> '{}'
$$;Reload the schema cache ( You don't have to select it to filter on it, but you can ( Because it's a one-line create extension if not exists pg_trgm;
create index on events using gin ((jsondata::text) gin_trgm_ops);With 100k rows, Docs: Computed fields If this solves it, please mark it as the answer so others with the same problem can find it. |
Uh oh!
There was an error while loading. Please reload this page.
So i can convert jsonb field in select (REST) as jsonbfield::text, but i can't do this for WHOLE jsonb field in filter. Only doable for subobjects with jsonbfield->>subobj, but not for the root object. Is there any way for that?
All reactions