Skip to content

Fix MIN and MAX nullability in CREATE TABLE AS SELECT - #4135

Merged
elianddb merged 1 commit into
dolthub:mainfrom
akasakariko:fix/dolt-12385-min-max-nullability
Nov 17, 2026
Merged

elianddb merged 1 commit into
dolthub:mainfrom
akasakariko:fix/dolt-12385-min-max-nullability

Conversation

@akasakariko

@akasakariko akasakariko commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

MIN and MAX can return NULL for a group containing only NULL values or for empty input, but their generated expressions marked the result as non-nullable, causing CREATE TABLE AS SELECT to fail

Declare both aggregates nullable in the generator, add a CTAS regression for both cases, and refresh existing schema and plan expectations

Fixes dolthub/dolt#12385

@elianddb elianddb self-assigned this Nov 11, 2026

@elianddb elianddb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtml! Thanks for the contribution.

@elianddb
elianddb merged commit ad7e568 into dolthub:main Nov 17, 2026
13 checks passed
@bpf120

bpf120 commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@akasakariko, thanks for the PR. We'd love to learn more about your use case. Feel free to email me or swing by our Discord.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CREATE TABLE AS SELECT with MAX(CASE...) fails when aggregate group result is NULL

4 participants