Skip to content

Conversation

@nnamdi16
Copy link
Contributor

@nnamdi16 nnamdi16 commented Nov 28, 2025

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 .* and attaching TableAlias.
Fix: 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

@georgesittas
Copy link
Collaborator

@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
Copy link
Contributor Author

nnamdi16 commented Dec 1, 2025

@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

@georgesittas
Copy link
Collaborator

Hey @nnamdi16, any plans to take this to the finish line?

@nnamdi16
Copy link
Contributor Author

nnamdi16 commented Dec 4, 2025

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.

…lect_expressions, mutating the original star and fixing normalization issues
@georgesittas georgesittas changed the title Qualify bare * and add table alias in Exasol Sqlglot Feat(exasol): qualify bare * and add table aliases to facilitate transpilation Dec 9, 2025
@georgesittas georgesittas changed the title Feat(exasol): qualify bare * and add table aliases to facilitate transpilation Feat(exasol): qualify bare stars to facilitate transpilations Dec 9, 2025
@georgesittas georgesittas changed the title Feat(exasol): qualify bare stars to facilitate transpilations Feat(exasol): qualify bare stars to facilitate transpilation Dec 9, 2025
@georgesittas georgesittas merged commit 2c013a5 into tobymao:main Dec 9, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants