Skip to content

failed deparser AST #131

Closed
Closed
@salisbury-espinosa

Description

@salisbury-espinosa
const result = parseQuerySync(`select from test_table WHERE status = 'complete'::text`);
const stmts = result.stmts.map(mapStmt);
deparse(stmts, {})

=>

deparser/deparser.ts:720
    if (node.val.String) {
                 ^
TypeError: Cannot read properties of undefined (reading 'String')

after fix:
https://github.com/launchql/pgsql-parser/blob/main/packages/deparser/src/deparser.ts#L720

if (node.val.String) { => if (node?.val?.String) {

result is

SELECT FROM test_table WHERE   null::undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions