Closed
Description
Describe the bug
When SQL Select statements use a UNION operator, the generated AST has a _next
property that contains the ASTs for the other tables being unioned. However this property is not exposed in the Select interface type so the typechecker fails when trying to access those nodes.
Database Engine
Snowflake
To Reproduce
node: 18.20.1
node-sql-parser: 5.3.2
import { Parser } from "node-sql-parser";
const parser = new Parser();
const opts = { database: "Snowflake" };
const query = `
SELECT user_id, timestamp
from login.account.password_reset
union
select user_id, timestamp
from "LOGIN"."ACCOUNT"."PASSWORD_UPDATED"
union
select user_id, timestamp
from LOGIN.ACCOUNT.SUCCESSFUL_LOGIN;
`;
const { ast } = parser.parse(query, opts);
const firstUnionTable = ast[0]._next
error TS2339: Property '_next' does not exist on type 'Select'
Expected behavior
should be able to access _next
without typescript throwing an error