Checks if a name (case-insensitive) is already allocated.
Returns the dialect-quoted form of a name via dialect.QuoteIdentifier().
Registers a name. If the name is already taken, generates a unique
suffix (Name__2, Name__3, ...) and returns the suffixed version.
The preferred name (unquoted)
The actual allocated name (may be suffixed if collision)
Generates a composition CTE name from a query name + hash, registers it, and returns the quoted form.
Pre-seeds the table with names that are already taken (e.g., outer CTE names).
Symbol table for managing CTE names during composition.
Guarantees uniqueness at CTE creation time — name collisions become impossible by construction.
All name comparisons are case-insensitive (SQL Server and PostgreSQL both treat unquoted identifiers case-insensitively for CTEs).