Search Postgresql Archives

Re: How to select values in a JSON type of column?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I looked at it yesterday, but I couldn't figure it out because my JSON is more nested and I got lost going down the path. 


On Wed, 18 Nov 2020 at 15:40, David G. Johnston <david.g.johnston@xxxxxxxxx> wrote:

On Wednesday, November 18, 2020, Snjezana Frketic <frketic.snjezana@xxxxxxxxx> wrote:


SELECT targeting#>'{targets,0,audienceSegments,0,includes,0,segments,allOf,0,ids}'FROM campaigns;  

and that works, but, I don’t want to have a fixed path because positions could change like 0 could become 1includes and excludes could change positions, allOf  could be anyOf etc.
Any idea of how to always select ids in includes no matter the changes?

  Maybe it can be done using json path:

 https://www.postgresql.org/docs/13/functions-json.html#FUNCTIONS-SQLJSON-PATH

David J.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux