Skip to content

fix coalesce type()#2301

Merged
jycor merged 7 commits intomainfrom
james/coalesce
Jan 30, 2024
Merged

fix coalesce type()#2301
jycor merged 7 commits intomainfrom
james/coalesce

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.

}
}

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
@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