-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
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_jsonSo 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.
Metadata
Metadata
Assignees
Labels
No labels