Thread: JSON query

JSON query

From
Scott Ribe
Date:
What's a good way to query jsonb column for

"no keys other than those in this list of keys"

in other words

"containing only keys from this list of keys"

--
Scott Ribe
scott_ribe@elevated-dev.com
https://www.linkedin.com/in/scottribe/






Re: JSON query

From
"David G. Johnston"
Date:
On Monday, October 18, 2021, Scott Ribe <scott_ribe@elevated-dev.com> wrote:

"containing only keys from this list of keys"


(jsonb - text[]) = ‘{}’::jsonb …?

Combine with (jsonb ?& text[]) if all tested keys need to be present as well.

David J.

Re: JSON query

From
Scott Ribe
Date:
> On Oct 18, 2021, at 10:02 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
>
> (jsonb - text[]) = ‘{}’::jsonb …?

Aha, thank you!