Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jsonb_each_text(jsonb_column) ILIKE '%val%'
- SELECT
- '{
- "col1": "somevalue",
- "col2": 5.5,
- "col3": 2016-01-01,
- "col4": "othervalue",
- "col5": "yet_another_value"
- }'::JSONB
- create table foo as SELECT '{"col1": "somevalue", "col2": 5.5, "col3": "2016-01-01", "col4": "othervalue", "col5": "yet_another_value"}'::JSONB as bar;
- create index pickfoo1 on foo ((bar #>> '{col1}'));
- create index pickfoo2 on foo ((bar #>> '{col2}'));
- -- Create index over lowered value:
- create index pickfoo1 on foo (lower(bar #>> '{col1}'));
- create index pickfoo2 on foo (lower(bar #>> '{col2}'));
- -- Check that it matches:
- select * from foo where lower(bar #>> '{col1}') = lower('soMEvaLUe');
- select * from foo where bar #>> '{col1}' ilike '%MEvaL%';
Add Comment
Please, Sign In to add comment