From a26116c6cbf4117e8efaa7cfc5bacc887f01517f Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Sat, 17 Feb 2018 19:02:15 -0300 Subject: Refactor format_type APIs to be more modular Introduce a new format_type_extended, with a flags bitmask argument that can modify the default behavior. A few compatibility and readability wrappers remain: format_type_be format_type_be_qualified format_type_with_typemod while format_type_with_typemod_qualified, which had a single caller, is removed. Author: Michael Paquier, some revisions by me Discussion: 20180213035107.GA2915@paquier.xyz --- src/include/utils/builtins.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/include/utils/builtins.h') diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index 8bb57c5829..3e462f1a9c 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -112,10 +112,17 @@ extern void clean_ipv6_addr(int addr_family, char *addr); extern Datum numeric_float8_no_overflow(PG_FUNCTION_ARGS); /* format_type.c */ + +/* Control flags for format_type_extended */ +#define FORMAT_TYPE_TYPEMOD_GIVEN 0x01 /* typemod defined by caller */ +#define FORMAT_TYPE_ALLOW_INVALID 0x02 /* allow invalid types */ +#define FORMAT_TYPE_FORCE_QUALIFY 0x04 /* force qualification of type */ +extern char *format_type_extended(Oid type_oid, int32 typemod, bits16 flags); + extern char *format_type_be(Oid type_oid); extern char *format_type_be_qualified(Oid type_oid); extern char *format_type_with_typemod(Oid type_oid, int32 typemod); -extern char *format_type_with_typemod_qualified(Oid type_oid, int32 typemod); + extern int32 type_maximum_size(Oid type_oid, int32 typemod); /* quote.c */ -- cgit v1.2.1