> On Apr 27, 2019, at 12:55 AM, Andrew Gierth <andrew@xxxxxxxxxxxxxxxxxxxx> wrote: > > Obvious solution: > > create function uuid_keys(mapData jsonb) returns uuid[] > language plpgsql immutable strict > as $$ > begin > return array(select jsonb_object_keys(mapData)::uuid); > end; > $$; > > create index on tbl using gin (uuid_keys(mapData)); > > select * from tbl where uuid_keys(mapData) && array[...]; Thank you Andrew, I modified it slightly to use `language sql` but otherwise it gets me going forward.