jaypipes / sqlb

A library for efficiently generating SQL expressions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When >1 table involved in SELECT, push down fully-qualified column names

jaypipes opened this issue · comments

By default, when there is more than a single table involved in a SELECT expression, we want to ensure that projected column names use the fully-qualified name (or aliased name). This ensures that the common scenario with multiple tables having like-named columns will not result in the the SQL server returning an error about ambiguous column names.

Seems to me that the best solution to this problem is just to always output the fully-qualified projection name, regardless of how many selections are present in the SelectClause. That way, we don't have inconsistent behaviour depending on the number of selections and we're always outputting safe SQL with no possibility of ambiguous column names.