Bruno Wolff III <[email protected]> writes:
> 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.
I might be misunderstanding, but I think you want to use -> not ->>
in these constraints and indexes. However, both of those operators
take a right-hand argument of type text to specify the key name,
so the 'foo'::text constants that you are seeing in the decompiled
expressions are expected either way. Those don't tell anything
about what the output type of the expression is.
regards, tom lane