Skip to content

Deparser does not handle MergeWhenClause #292

@ivanbulanov

Description

@ivanbulanov
import { parse, deparse } from 'pgsql-parser';

const sql = `MERGE INTO t AS target
  USING (SELECT 1 AS id) AS source ON target.id = source.id
  WHEN MATCHED THEN UPDATE SET name = 'x'
  WHEN NOT MATCHED THEN INSERT (id, name) VALUES (source.id, 'x')`;

const ast = parse(sql);   // succeeds
deparse(ast);              // throws: does not handle node type: MergeWhenClause

The parser handles MERGE (added in PostgreSQL 15) but the deparser has no visitor for MergeWhenClause. Tested on pgsql-deparser@17.18.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions