jsquery icon indicating copy to clipboard operation
jsquery copied to clipboard

how to select the jsonb value for particular key using JSQuery?

Open bibekdw opened this issue 7 years ago • 2 comments

is it possible to select the value for the key in json using JSQuery?

Something like this: SELECT value @@ (.color) FROM js_test WHERE value @@ '.color = *'

Basically I am interested to see the value of color key in all the json documents if available. My key could be present in any level inside the json.

Thanks.

bibekdw avatar Oct 17 '18 20:10 bibekdw

I have the same question. Is it possible to use jsquery inside the select part or only in the where?

abonec avatar Nov 16 '18 16:11 abonec

  1. I have doubts about your pseudocode example. The @@ operator returns true/false, so it's not clear to me what and how you want to achieve.
  2. Yes, the jsquery functionality can be freely used in the SELECT expression. Example from tests:
select 'asd(zzz < 13)'::jsquery;
     jsquery      
------------------
 "asd"."zzz" < 13
(1 row)``

sokolcati avatar Nov 17 '23 13:11 sokolcati