/** * AST visitor to hoist WITH clauses out of UNION and other set operations. * * Drizzle can emit SQL like: * (with a as (...) select ...) union (with b as (...) select ...) * * DuckDB 1.4.x has an internal binder bug for this pattern. * We merge per arm CTEs into a single top level WITH when names do not collide. * * Hoisting is skipped when it would change the query: * - an arm has ORDER BY, LIMIT or OFFSET, since the merged form drops the * parentheses that scope those clauses to the arm * - a CTE name matches a table referenced by another arm, since the hoisted * CTE would shadow that table * * When any arm uses WITH RECURSIVE, the merged WITH is RECURSIVE. That is * skipped when a CTE from a plain WITH reads a table of its own name. */ import type { AST } from 'node-sql-parser'; export declare function hoistUnionWith(ast: AST | AST[]): boolean;