Repository navigation
Conversation
`SELECT ROW_NUMBER() OVER (ORDER BY id) FROM t` answered `42883 function row_number() does not exist`. The window spec named the item by its printed text, and the projection named it by that text in lower case. The two names never matched, so the window column fell through to the scalar evaluator. The window spec now lowers the text too, as the projection does.
unaliased_item_name (nee a bare .to_lowercase() on the formatted expression) folded a string literal's own case along with everything else. Two unaliased items differing only by a quoted literal (tag = 'A' vs tag = 'a') collapsed onto the same generated name, even though Value::String equality is case-sensitive -- the two compute different values. HashMap-keyed row insertion then let the second window spec's write silently overwrite the first's: both output columns reported the second window's value, the first lost with no error. unaliased_item_name now walks the rendered text and folds everywhere except inside a single-quoted span, tracking SQL's '' escape so an escaped quote never toggles out of the literal early. The one function now serves both call sites (select/helpers.rs's own projections and window/extract.rs's window specs), keeping them on the same name for the original bug (an unaliased window call's column must match its projection) without re-introducing this one.
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.
SELECT ROW_NUMBER() OVER (ORDER BY id) FROM tanswered42883 function row_number() does not exist. The window spec named the item by its printed text, and the projection named it by that text in lower case. The two names never matched, so the window column fell through to the scalar evaluator. The window spec now lowers the text too, as the projection does.