Conversation
`SELECT u.* FROM users AS u` produced `Wildcard { table: "u" }`. `u` is
the alias, not a relation: it appears in no catalog and in no
`tables.inputs`, which reports `users`.
Two consequences. The output claimed a relation the table graph says does
not exist, the same defect class as #23. And `apply_catalog` expands a
wildcard by calling `list_columns` on the table it names, so the star
stayed unexpanded even with a catalog that knows `users` perfectly well.
`expand_star` already looks the name up in the scope; it only used the
binding to recurse into a CTE or derived table and ignored it when it was
a real table. It now names the relation the binding points at.
Taken from eitsupi's `a612e01` in #15. The rest of that commit patches
`star_arity`, which does not exist here, and is left for the set-operation
rework.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`Dialect` was the one public enum carrying it, on the reasoning that `sqlparser` gains dialects and adding one should not break downstream matches. `ColumnOrigin` was deliberately left exhaustive on the opposite reasoning, and #23 documented why. Two rules for two enums is a distinction worth maintaining only if the cost it avoids is real. It is not, here: the crate is pre-1.0, and a consumer that maps `Dialect` into its own vocabulary is better served by a compile error naming the new dialect than by a `_` arm that routes it somewhere silently. Removing the attribute is permissive for anyone already matching non-exhaustively, so nothing downstream breaks today. ARCHITECTURE.md now states the rule once, for every public enum, rather than as a property of `ColumnOrigin`. This also settles a conflict ahead of time: eitsupi's `9da186b` in #15 marks both `Dialect` and `ColumnOrigin` `#[non_exhaustive]`, and that part will be dropped when the rest of it is reconstructed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three small changes from the #15 backlog. The first two are the same defect class as #23 — a relation or column name in the output that the rest of the result denies exists. The third settles an API question that #15's remaining work would otherwise reopen.
SELECT base.items_array[1] FROM actual_table AS baseCherry-picked from #14/#16 (
968ed01), authorship preserved; applies tomainunchanged.collect_ancestorshandledExpr::CompoundFieldAccessby recursing intorootand discarding the access chain. Forbase.items_array[1]the root is the relation alias, so the alias became the column:baseis a relation alias, not a column ofactual_table. Whether the root is a relation or a struct-valued column is not decidable from the text —payload.items[1]is the second case — so the fix asks the scope:The last one is a struct root with no binding, and already resolved correctly.
SELECT u.* FROM users AS uTaken from
a612e01in the same backlog; the rest of that commit patchesstar_arity, which does not exist here, and is left for the set-operation rework.uis the alias.tables.inputsreportsusers, so the column graph named a relation the table graph denies. It also blocked expansion:apply_catalogexpands a wildcard by callinglist_columnson the table it names, and no catalog knowsu, soSELECT u.* FROM users AS ustayed unexpanded even with a catalog that hasusers.expand_staralready looked the name up in the scope; it used the binding only to recurse into a CTE or derived table and ignored it when it was a real table.#[non_exhaustive]onDialectDialectwas the one public enum carrying it, added in #18 on the reasoning that sqlparser gains dialects and adding one should not break downstream matches. #23 leftColumnOriginexhaustive on the opposite reasoning and documented why.Two rules for two enums is worth maintaining only if the cost avoided is real, and pre-1.0 it is not: a consumer mapping
Dialectinto its own vocabulary is better served by a compile error naming the new dialect than by a_arm that routes it somewhere silently. Removing the attribute is permissive for anyone already matching non-exhaustively, so nothing downstream breaks today.ARCHITECTURE.mdnow states the rule once, for every public enum.This also settles a conflict ahead of time:
9da186bin #15 marks bothDialectandColumnOrigin#[non_exhaustive], and that part will be dropped when the rest of it is reconstructed.Tests
968ed01's six tests come with it. Two added for the alias star — one without a catalog, one checking the catalog now expands it, including through a CTE. Both fail onmain.Compatibility
ColumnOriginvalues change for the two shapes above; both were wrong. Dropping#[non_exhaustive]is permissive. A 0.3.0 item alongside #18, #23 and #25.🤖 Generated with Claude Code