On Mon, Nov 30, 2026 at 21:04:09 -0800,
Adrian Klaver <[email protected]> wrote:
On 11/30/26 6:07 PM, Bruno Wolff III wrote:
I have jsonb data in a table and created a function index on an
order number in the data. I expected all of the references to use
jsonb data, but it is converting to text and using json.
jsonb ->> text → text
Seems you are getting what you asked for.
I expected the final result to be text. The part that surprised me is
the function converting the intermediate steps to text and json, instead
of keeping everything jsonb until the last step.
CREATE UNIQUE INDEX ON cert_orders (
(order_data->'GetOrderReport'->>'orderNumber'));
"cert_orders_expr_idx" UNIQUE, btree (((order_data ->
'GetOrderReport'::text) ->> 'orderNumber'::text))
Why convert order_data->'GetOrderReport' to text in order to use json ->>
instead of jsonb ->> in order to get the orderNumber?