Quantcast
Viewing all articles
Browse latest Browse all 207

Using a key:value pair from 1 jsonb column on table A as a filter for jsonb column on table B

Table A with JSONB column (simplified, there is more data than just 1 k:v):

{"subject": "identifier": {"system": "system-value", "value": "1234-5678"}}

Table B JSONB column:

{["identifier": {"otherInfo": {"blah": 123}, "system": "system-value", "value": "1234-5678"},"identifier": {"otherInfo": {"blah": 345}, "system": "other-system", "value": "qazwsx-edcrfv"}]}

I'm trying to find the best way to get a record from table A where table.document -> 'subject' ->> 'system' and 'value' (pseudo code) is in table.document -> 'identifier'. Table B will likely have other filters applied before table A searches on its result set.


Viewing all articles
Browse latest Browse all 207

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>