[pull] main from dolthub:main - #242
Merged
Merged
Conversation
In Postgres, a function called in the FROM list may reference columns of tables that precede it in the same FROM clause: it is an implicit LATERAL join, and the LATERAL keyword is a noise word for function-call FROM items. Queries like the following now work: SELECT k.u FROM pg_index i, unnest(i.indkey) AS k(u) WHERE i.indexrelid = 'bug15_ab'::regclass; Function-call FROM items that follow another FROM item are now marked as lateral during AST conversion, and lateral function items are converted to a TableFuncExpr wrapped in a lateral subquery, which GMS knows how to scope and execute. This also fixes the explicit LATERAL keyword before a function call in FROM, which previously failed with an unsupported-syntax error, and WITH ORDINALITY over such functions. Fixes #3112
Fixes #3110: pg_index.indoption was hardcoded to a single-element vector regardless of how many columns the index has. It now emits one entry per key column (matching indkey's cardinality). Dolt indexes are always stored ascending and don't record per-column direction, so every entry is 0 (ASC NULLS LAST, the btree default). Also fixes the neighboring per-column vectors and count that had the same bug: - indcollation and indclass were empty vectors; they now contain one zero OID per key column - indnkeyatts was hardcoded to 0; it now equals indnatts (INCLUDE columns aren't supported, so all index columns are key columns)
A left lateral join over a set-returning function that produces no rows must still return the left row, null-extended. Requires the go-mysql-server fix on branch zachmu/lateral-left-join-on-true (memo exec builder rebuilt filterless lateral joins as lateral cross joins) plus a GMS dependency bump.
GMS no longer sets the max1Row query flag when the plan contains an expression that returns a RowIter, so the rule undoing that flag is no longer needed. Requires a GMS bump to pick up the fix.
The final projection re-evaluated set-returning expressions already expanded by the projection materialized below the sort, multiplying the output rows and clobbering the sort order. Fixed in GMS; requires a GMS bump to pick up.
…lumn was renamed to ErrFieldNoDefaultValue
# Conflicts: # go.mod # go.sum
The implicit alias triggered GMS's Postgres alias-as-column-name behavior, renaming a single-column function result to the function's name and clobbering the column name provided by a named OUT parameter (e.g. pg_partition_ancestors' relid, used by psql's \d foreign-key listing query). Only the lateral wrapping subquery needs a fabricated alias; the TableFuncExpr itself keeps the user's alias, and GMS already names an unaliased function table after the function while leaving its column names alone.
Covers the OUT-parameter column naming that psql's \d foreign-key listing query depends on: unaliased functions keep their OUT parameter's column name while the table takes the function's name, and a table alias renames a single-column result.
Support implicit lateral joins for set-returning functions in FROM
Fix max1Row error for set-returning functions over point lookups
Fix pg_index per-column vectors to have one entry per key column
[no-release-notes] Fix SQLAlchemy pg_index expectation
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )