forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: prefer aggregate overloads with string inputs
Prior to this commit, the type checking code was not able to choose between different possible aggregate overloads if the arguments had type unknown. This commit changes the logic to match Postgres, which always prefers overloads with arguments of type string if available. Note that this commit still doesn't completely match Postgres' behavior, because it doesn't handle the case when there are no overloads available with string inputs for the arguments with unknown type. If there are no overloads with string arguments, Postgres chooses the overload with preferred type for the given category. For example, float8 is the preferred type for the numeric category in Postgres. Since we don't support the concept of preferred types within type categories, supporting this behavior will be a more involved change. For now, this commit should cover most of our supported aggregates. Release justification: low risk, high benefit change to existing functionality. Release note (sql change): the type checking code now prefers aggregate overloads with string inputs if there are multiple possible candidates due to arguments of unknown type.
- Loading branch information
Showing
3 changed files
with
64 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters