Re: JSONB operator unanticipated behaviour

2023-05-18 Thread Adrian Klaver
On 5/18/23 09:36, Tom Lane wrote: Adrian Klaver writes: On 5/18/23 08:46, Tom Lane wrote: You seem to be reading some fairly old version of the documentation. The extended definition that Adrian mentions has been there for awhile, but the JSON operator table didn't link to it before v13. (I ag

Re: JSONB operator unanticipated behaviour

2023-05-18 Thread Tom Lane
Adrian Klaver writes: > On 5/18/23 08:46, Tom Lane wrote: >> You seem to be reading some fairly old version of the documentation. >> The extended definition that Adrian mentions has been there for >> awhile, but the JSON operator table didn't link to it before v13. >> (I agree that the "top level"

Re: JSONB operator unanticipated behaviour

2023-05-18 Thread Adrian Klaver
On 5/18/23 08:46, Tom Lane wrote: Brian Mendoza writes: Ah, yes, that seem to be the explanation! So it would seem that indeed it was my misunderstanding of the operator. You seem to be reading some fairly old version of the documentation. The extended definition that Adrian mentions has been

Re: JSONB operator unanticipated behaviour

2023-05-18 Thread Tom Lane
Brian Mendoza writes: > Ah, yes, that seem to be the explanation! > So it would seem that indeed it was my misunderstanding of the operator. You seem to be reading some fairly old version of the documentation. The extended definition that Adrian mentions has been there for awhile, but the JSON op

Re: JSONB operator unanticipated behaviour

2023-05-18 Thread Brian Mendoza
Ah, yes, that seem to be the explanation! So it would seem that indeed it was my misunderstanding of the operator. select '{"a": [1,2]}'::jsonb @> '{"a": [1]}'::jsonb; ?column? -- t (1 row) select '{"a": [1,2]}'::jsonb @> '{"a": [2,1,2]}'::jsonb; ?column? -- t (1 row) I was

Re: JSONB operator unanticipated behaviour

2023-05-18 Thread Adrian Klaver
On 5/18/23 06:17, Brian Mendoza wrote: Hello, I have encountered unanticipated behaviour with a JSONB operator, and wanted to make sure I am not misunderstanding its intended use. When using the @> operator, I get this result. select '{"a": [1]}'::jsonb @> '{"a": []}'::jsonb;  ?column?