Qualify bare * and add table alias in Exasol Sqlglot
What motivated this PR? Exasol doesn't support a bare * alongside other select items.
How is the existing logic in main incorrect?
For example, when transpiling SELECT *, 1 FROM TEST to Exasol, the query returned (SELECT *, 1 FROM TEST) would fail because Exasol requires that the bare * is scoped with an alias.
How does the PR address the aforementioned issues?
The PR preprocesses SELECT by transforming unscoped star to SELECT *, 1 FROM TEST -> SELECT T.*, 1 FROM TEST AS T
Provide documentation for the SQL functions involved in the implementation & explain whether semantics change / are preserved The issue is not specifically stated in the documentation, but I can provide a screenshot if required
@nnamdi16 it seems like this PR does not handle SELECT * queries with multiple sources, e.g.:
> with t1 as (select 1 as c1), t2 as (select 2 as c2) select *, 3 from t1, t2; -- this is in DuckDB
┌───────┬───────┬───────┐
│ c1 │ c2 │ 3 │
│ int32 │ int32 │ int32 │
├───────┼───────┼───────┤
│ 1 │ 2 │ 3 │
└───────┴───────┴───────┘
I think we would need to add t1.*, t2.*, etc., in order for this conversion to be complete.
@nnamdi16 it seems like this PR does not handle
SELECT *queries with multiple sources, e.g.:> with t1 as (select 1 as c1), t2 as (select 2 as c2) select *, 3 from t1, t2; -- this is in DuckDB ┌───────┬───────┬───────┐ │ c1 │ c2 │ 3 │ │ int32 │ int32 │ int32 │ ├───────┼───────┼───────┤ │ 1 │ 2 │ 3 │ └───────┴───────┴───────┘I think we would need to add
t1.*,t2.*, etc., in order for this conversion to be complete.
Its a very good idea @georgesittas. I would look into it
Hey @nnamdi16, any plans to take this to the finish line?
SELECT T.*, 1 FROM TEST AS T
Hey @nnamdi16, any plans to take this to the finish line?
Yes @georgesittas I would fix the concerns.