Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix coalesce type() #2301

Merged
merged 7 commits into from
Jan 30, 2024
Merged

fix coalesce type() #2301

merged 7 commits into from
Jan 30, 2024

Conversation

jycor
Copy link
Contributor

@jycor jycor commented Jan 30, 2024

Although only the first argument is returned, coalesce still examines the types of all the arguments passed in, and uses the "largest" type.

@@ -552,3 +552,76 @@ func TypesEqual(a, b sql.Type) bool {
return a == b
}
}

func BiggerType(a, b sql.Type) sql.Type {
Copy link
Contributor

Choose a reason for hiding this comment

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

does sql.Type.Promote simplify any of this/more future proof? We have "to biggest" type coercion in other places also, like mergeSetOpSchemas, do we need two paths for this?

Copy link
Contributor

@max-hoffman max-hoffman left a comment

Choose a reason for hiding this comment

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

new version seems more straightforward imo, thanks

@jycor jycor merged commit 140a153 into main Jan 30, 2024
7 checks passed
@jycor jycor deleted the james/coalesce branch January 30, 2024 21:45
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.

2 participants