Skip to content

Handle ragged multi-row INSERT in values_dict#661

Closed
santhreal wants to merge 4 commits into
macbre:masterfrom
santhreal:fix/values-dict-ragged-rows
Closed

Handle ragged multi-row INSERT in values_dict#661
santhreal wants to merge 4 commits into
macbre:masterfrom
santhreal:fix/values-dict-ragged-rows

Conversation

@santhreal

Copy link
Copy Markdown

Parser.values_dict hits IndexError when INSERT multi-row ragged VALUES (1,2),(3). This PR fixes the regression with a focused test covering the case. claimed

values_dict indexed every row by the first row width, so shorter
VALUES tuples raised IndexError. Pad missing cells with None.
Replace per-index padding with zip_longest so short INSERT VALUE rows
fill missing columns with None without manual bounds checks.
zip_longest alone sized the dict by the longest VALUES row, dropping
declared columns when every row was shorter. Align to len(columns) and
cover INSERT ... VALUES (1), (2).
Replace zip_longest transpose with per-column indexing so multi-row and
single-row INSERT paths both keep every declared column.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant