Re: Unable to make use of "deep" JSONB index - Mailing list pgsql-bugs

From Jeff Janes
Subject Re: Unable to make use of "deep" JSONB index
Date
Msg-id CAMkU=1zHod+UktMioLywae=NsEtAmFe1S1VRqSqSqin4NGXH6Q@mail.gmail.com
Whole thread Raw
In response to Re: Unable to make use of "deep" JSONB index  (Shaheed Haque <shaheedhaque@gmail.com>)
Responses Re: Unable to make use of "deep" JSONB index  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs


On Sun, Jun 12, 2022 at 5:34 AM Shaheed Haque <shaheedhaque@gmail.com> wrote:
OK, I have corrected and simplified the test case (including switching
to a btree index). The WHERE clause and the inex now look like this:

    ...WHERE         ((snapshot -> 'employee' -> '999' ->>
'pay_graph')::integer != 0);
    ...USING btree (((snapshot -> 'employee' -> '$.*'  ->>
'pay_graph')::integer != 0));

But, this is not a correction.  You are still trying to use -> as if it were @?, and that is still not going to work.

You are indexing the part of snapshot which has the employee number of '$.*', which is a weird employee number for anyone to have.  You might want to represent a wildcard but that is not what -> does.

Cheer,

Jeff

pgsql-bugs by date:

Previous
From: Shaheed Haque
Date:
Subject: Re: Unable to make use of "deep" JSONB index
Next
From: Tom Lane
Date:
Subject: Re: Unable to make use of "deep" JSONB index