This repository was archived by the owner on Feb 6, 2025. It is now read-only.

Description
The maximum identifier (column, alias, or cte name) length in mssql is 128 characters. We currently exceed that limit on queries that are not too crazy in various ways:
- Columns exposed in a cte are labelled with
"_".join(vertex_path) + "__" + used_column_name. This would exceed the character limit in a query with a deep traversal before a @recurse is used.
- In fold scopes we prepend
folded_subquery_ to existing mssql identifiers. This can only be a problem if the existing column name is very long. Looks unlikely and low-priority to me.
- For table aliases we append
_1, _2, etc to an existing table name. This is also unlikely to cause problems, so it's an extremely low-priority issue.
To address the cte column labeling problem, we can simply choose arbitrary or numbered labels. It will work as long as they are unique.
@chewselene please correct me if I'm missing something.