You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add SELECT * projection: bare * expands to all columns from all FROM sources in order, t.* filters to one source. StarProjection placeholder lands in the projection list at parse time and ExpandStars replaces it with per-column Reference expressions (qualified by each source's alias) after FROM is parsed, so multi-source * keeps duplicates without tripping Msg 209. Unbound qualifier raises Msg 4104; the * multiplication operator and count(*) paths are untouched.
Copy file name to clipboardExpand all lines: CLAUDE.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -165,6 +165,9 @@ APPLY is the lateral form: the right side is a derived-table SELECT re-executed
165
165
166
166
`JoinDriver`'s lateral branch handles both APPLY (CrossApply / OuterApply, no ON predicate) and ordinary derived tables in INNER / LEFT / CROSS join slots — the latter apply their `ON` predicate after the inner row materializes, and LEFT joins null-fill on no-match the same way OUTER APPLY does. Leftmost-source lateral plans run from the surrounding `outerResolver` directly (no per-tuple feedback at level 0).
167
167
168
+
### `SELECT *` projection
169
+
Bare `*` and qualified `<source>.*` both work. `*` expands to every column of every FROM source in source order; `t.*` filters to one source. Multi-source `*` keeps duplicate column names (e.g. a join on a same-named key emits the key twice). Expansion happens after FROM is parsed via `ExpandStars` in `Selection.cs`, replacing the placeholder `StarProjection` in the projection list with per-column `Reference` expressions qualified by each source's alias / table name — qualifying is what lets duplicates land without tripping Msg 209's ambiguous-column check. Unbound `<qualifier>.*` raises Msg 4104. The `*`*operator* (multiplication) is unchanged: it's only intercepted as star when it appears at projection-element-start position, so `select 5 * 3` still parses as multiplication and `count(*)` continues through its own AggregateExpression path.
170
+
168
171
### CASE
169
172
Searched (`CASE WHEN cond THEN ... [ELSE ...] END`) and simple (`CASE input WHEN val ...`). Branches evaluate in order; first true predicate wins. UNKNOWN excludes (matches WHERE); simple-form `CASE NULL WHEN NULL` falls through. Result type computed via `SqlType.Promote` across all THEN/ELSE, cached on first `GetSqlType`; `Run` coerces matched values to the common type. No-match-no-ELSE → typed NULL.
0 commit comments