From f893e68d761adbee7f888109b1adf76151e3e17a Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 27 Oct 2020 17:39:23 +0100 Subject: Add select_common_typmod() This accompanies select_common_type() and select_common_collation(). Typmods were previously combined using hand-coded logic in several places. The logic in select_common_typmod() isn't very exciting, but it makes the code more compact and readable in a few locations, and in the future we can perhaps do more complicated things if desired. As a small enhancement, the type unification of the direct and aggregate arguments of hypothetical-set aggregates now unifies the typmod as well using this new function, instead of just dropping it. Reviewed-by: Heikki Linnakangas Discussion: https://www.postgresql.org/message-id/flat/97df3af9-8b5e-fb7f-a029-3eb7e80d7af9@2ndquadrant.com --- src/include/parser/parse_coerce.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/include/parser') diff --git a/src/include/parser/parse_coerce.h b/src/include/parser/parse_coerce.h index 8686eaacbc..33d7cfc8b6 100644 --- a/src/include/parser/parse_coerce.h +++ b/src/include/parser/parse_coerce.h @@ -71,6 +71,8 @@ extern Node *coerce_to_common_type(ParseState *pstate, Node *node, Oid targetTypeId, const char *context); +extern int32 select_common_typmod(ParseState *pstate, List *exprs, Oid common_type); + extern bool check_generic_type_consistency(const Oid *actual_arg_types, const Oid *declared_arg_types, int nargs); -- cgit v1.2.3