hi, it seems like some stuff is going wrong with cast-ed jsonb dereferencing:
import * as pgsqlAstParser from 'pgsql-ast-parser'
const input = `select json->'foo'::text->>'bar'::text as bar from json_table`
const ast = pgsqlAstParser.parse(input)[0]
const output = pgsqlAstParser.toSql.statement(ast)
console.log(output) // SELECT ((((json->'foo')::text )->>'bar')::text ) AS bar FROM **table_with_json
So you can see it casts json->'foo' to text, and then when we try to do ->>'bar', there will be an error because ->> is an operator on jsonb, not text.
hi, it seems like some stuff is going wrong with cast-ed jsonb dereferencing:
So you can see it casts
json->'foo'to text, and then when we try to do->>'bar', there will be an error because->>is an operator on jsonb, not text.