With postgres, when rendering an equals, if the right value is a Json value, the left value gets casted to a ::jsonb.
This was causing issues with json_extract because it's rendered as such: col#>ARRAY['a','b']::text.
Appending ::jsonb to col#>ARRAY['a','b']::text, was causing an error. This fix adds parenthesis around col#>ARRAY['a','b']::text so that the whole expression properly gets casted as (col#>ARRAY['a','b']::text)::jsonb.
Overview
With postgres, when rendering an
equals
, if the right value is a Json value, the left value gets casted to a::jsonb
.This was causing issues with
json_extract
because it's rendered as such:col#>ARRAY['a','b']::text
.Appending
::jsonb
tocol#>ARRAY['a','b']::text
, was causing an error. This fix adds parenthesis aroundcol#>ARRAY['a','b']::text
so that the whole expression properly gets casted as(col#>ARRAY['a','b']::text)::jsonb
.A regression test was also added.