Hot answers tagged

3

You need to extract the value as text which is done using the ->> operator (-> returns a json value). SELECT * FROM job_request_table p cross join json_array_elements(p.data_meta) as d(element) where d.element ->> 'data_type' = 'Insurance'; However, given your sample data, this would result in the error "cannot extract elements from ...


2

This won't work. In particular, you cannot create a single index that will support conditions like WHERE (user_properties ->> 'some random property')::date >= '2000-01-01'::date for arbitrary attributes. You will have to identify the properties you want to use in comparisons and create specialized indexes on these properties. In the above sample, ...


Only top voted, non community-wiki answers of a minimum length are eligible