EXPAND
Replaces the current SQL's SELECT * / alias.* projection with real column names from database metadata
Arguments
None.
Examples
SELECT * FROM CUSTOMER;
EXPAND;
//
Notes
EXPAND; - explicitly rewrites the current SQL's SELECT * / alias.* projection(s) into the real column names of the relation(s) they refer to, resolved from database metadata (see docs/SPRINT_0912A_EXPAND_FORMAT_SQL_ERRORS.md, section 4).
This is a transformation, not an execution command: it never runs the current SQL, only rewrites it. On success, the expanded SQL becomes the current SQL - ///SHOW QUERY display it and / reruns it. On failure (unsupported shape, unresolvable relation, ambiguous alias, no expandable * at all), the current SQL is left byte-for-byte unchanged and a concise reason is printed - nothing is ever executed as a side effect.
Supported: SELECT * FROM TABLE, schema-qualified tables, alias.* with or without AS, a naked * only when the query has exactly one relation (no JOIN), and alias.* across a JOIN chain. Never touched: COUNT(*), arithmetic (a*b), and any * inside a string literal or comment
- the underlying scanner only ever considers a bare
*oralias.*that forms an entire projection item by itself. Not supported in this version: a derived table/subquery or CTE as theFROMsource, and a naked*over more than one relation (its result-column order and duplicate-name handling cannot be reproduced reliably - qualify withalias.*instead).
Last modified in release 5.2.0.
BroadSQL