Using vars in jsonbpath operator ?

From: Markur Sens <markursens(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Using vars in jsonbpath operator ?
Date: 2023-06-16 11:54:35
Message-ID: 4A219290-0DC1-4782-85F6-55CA334192C3@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I understand that on a where clause a gin index can be used for the following predicate

a.data @? '$.results.docs[*].accs[*] ? (@.id == “123")

I have a join query however on the following condition

jsonb_path_exists(a.data, '$.results.docs[*].accs[*] ? (@.number == $id)', jsonb_build_object(‘id', b.id)) but this cannot use a gin index afaik and results in a seq scan.

Is there anyway to use the operator syntax above by passing the b.id <http://b.id/> variable somwehow so that the gin index can be used ? ?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2023-06-16 12:13:39 Re: Question: Multiple pg clusters on one server can be reached with the standard port.
Previous Message Brainmue 2023-06-16 11:53:41 Re: Question: Multiple pg clusters on one server can be reached with the standard port.