Skip to content

[pull] main from dolthub:main - #242

Merged
pull[bot] merged 22 commits into
TheTechOddBug:mainfrom
dolthub:main
Sep 1, 2026
Merged

[pull] main from dolthub:main#242
pull[bot] merged 22 commits into
TheTechOddBug:mainfrom
dolthub:main

Conversation

@pull

@pull pull Bot commented Sep 1, 2026

Copy link
Copy Markdown

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 : )

zachmu and others added 22 commits August 20, 2026 16:36
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.
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
@pull pull Bot locked and limited conversation to collaborators Sep 1, 2026
@pull pull Bot added the ⤵️ pull label Sep 1, 2026
@pull
pull Bot merged commit 0a1a307 into TheTechOddBug:main Sep 1, 2026
8 of 22 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

2 participants