Repository navigation
Resolve a JSON set-returning function's alias as PostgreSQL does - #253
Merged
Merged
Conversation
…deny wasm32 warnings
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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 e FROM jsonb_array_elements_text('["a","b"]'::jsonb) AS eanswersa,bon PostgreSQL 18.6 andno such column: eafter translation. PostgreSQL reads a bare name that no column answers as the whole row of the relation it names, and the row of a one-column function is its value. The derived table pg2sqlite builds overjson_eachexposes onlyvalue, so SQLite found nothing callede. The keys functions had a second problem. PostgreSQL names their one column after the alias, and the projection named itjson_object_keys.A bare name that no column in scope answers, and that names a set-returning JSON function's relation, reads that function's column, and the output keeps the alias as its name. The
valuefunctions keep their declaredvaluecolumn, soe.valueandvalueresolve ande.efails as it does in PostgreSQL. The row of a two-column function such asjsonb_eachis a record, which SQLite has no value for, so a bare reference to it is refused naming the alias. A column calledewins over the row, at the same level or an enclosing one, matching PostgreSQL. ASELECTinside aUNIONresolves against the same scope as a standalone one, which the set-operation case needed.The same commit drops an unused
ToOwnedimport that only the no-std build warned about, and makes theno_std (wasm32)job deny warnings so the next one fails CI.