Fix max1Row error for set-returning functions over point lookups - #3151
Fix max1Row error for set-returning functions over point lookups#3151zachmu wants to merge 1 commit into
Conversation
GMS sets QFlagMax1Row when a query is a strict unique-index point lookup,
and the DoltgresHandler uses that flag to take a result-spooling shortcut
that errors if more than one row is produced. That analysis doesn't account
for set-returning functions (unnest, generate_series, etc.) in the
projection, which multiply output rows:
SELECT unnest(indkey) FROM pg_index WHERE indexrelid = 'x'::regclass;
ERROR: result max1Row iterator returned more than one row
Adds a new analyzer rule, UnsetMax1RowForSRFs, to the OnceAfterAll batch
that unsets QFlagMax1Row whenever the plan contains an expression
implementing sql.RowIterExpression that returns a row iterator (the
representation of SRFs in Doltgres, e.g. CompiledFunction.IsSRF).
Only the simple query protocol takes the max1Row shortcut, so the
regression tests include wire-level tests using pgproto3.Query in addition
to the extended-protocol ScriptTests.
Fixes #3111
Footnotes
|
|
SummaryThe run broadly exercised database query behavior across ordinary lookups, expanding result sets, empty results, repeated and mixed queries, multiple source rows, and recovery after invalid input. It also covered an unsupported lateral query shape that remains a compatibility gap, while the tested non-lateral paths behaved normally. Safe to merge — the only observed failure is a medium-severity, pre-existing limitation unrelated to this PR, with no regression or PR-attributable failure identified. The change’s covered query and recovery behaviors remain healthy, so the lateral limitation is a flag for later rather than a merge blocker. Tests run by ItoAdditional Findings DetailsThese findings are unrelated to the current changes but were observed during testing. 🟡 Lateral queries fail to return generated rows
Evidence PackageTip Reply with @itoqa to send us feedback on this test run. |
|
@zachmu DOLT
|

Fixes a "result max1Row iterator returned more than one row" error when a set-returning function is projected over a unique-index point lookup.
Fixes #3111.