diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-11-03 18:42:02 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-11-03 18:42:18 -0500 |
commit | d89494166351e1fdac77d87c6af500401deb2422 (patch) | |
tree | e52b846d65238f4de8515daed56b585467bde7cd /src | |
parent | ee44cb7566ffafc0144535e1f966f5e3bb7d384b (diff) | |
download | postgresql-d89494166351e1fdac77d87c6af500401deb2422.tar.gz postgresql-d89494166351e1fdac77d87c6af500401deb2422.zip |
Allow postgres_fdw to ship extension funcs/operators for remote execution.
The user can whitelist specified extension(s) in the foreign server's
options, whereupon we will treat immutable functions and operators of those
extensions as candidates to be sent for remote execution.
Whitelisting an extension in this way basically promises that the extension
exists on the remote server and behaves compatibly with the local instance.
We have no way to prove that formally, so we have to rely on the user to
get it right. But this seems like something that people can usually get
right in practice.
We might in future allow functions and operators to be whitelisted
individually, but extension granularity is a very convenient special case,
so it got done first.
The patch as-committed lacks any regression tests, which is unfortunate,
but introducing dependencies on other extensions for testing purposes
would break "make installcheck" scenarios, which is worse. I have some
ideas about klugy ways around that, but it seems like material for a
separate patch. For the moment, leave the problem open.
Paul Ramsey, hacked up a bit more by me
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/adt/format_type.c | 16 | ||||
-rw-r--r-- | src/include/utils/builtins.h | 1 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/backend/utils/adt/format_type.c b/src/backend/utils/adt/format_type.c index a8519835cc6..e046f05f28c 100644 --- a/src/backend/utils/adt/format_type.c +++ b/src/backend/utils/adt/format_type.c @@ -97,7 +97,8 @@ format_type_be(Oid type_oid) } /* - * This version returns a name which is always qualified. + * This version returns a name that is always qualified (unless it's one + * of the SQL-keyword type names, such as TIMESTAMP WITH TIME ZONE). */ char * format_type_be_qualified(Oid type_oid) @@ -114,6 +115,19 @@ format_type_with_typemod(Oid type_oid, int32 typemod) return format_type_internal(type_oid, typemod, true, false, false); } +/* + * This version allows a nondefault typemod to be specified, and forces + * qualification of normal type names. + */ +char * +format_type_with_typemod_qualified(Oid type_oid, int32 typemod) +{ + return format_type_internal(type_oid, typemod, true, false, true); +} + +/* + * Common workhorse. + */ static char * format_type_internal(Oid type_oid, int32 typemod, bool typemod_given, bool allow_invalid, diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index fc1679ed462..c193e4425ed 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -1105,6 +1105,7 @@ extern Datum format_type(PG_FUNCTION_ARGS); 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 Datum oidvectortypes(PG_FUNCTION_ARGS); extern int32 type_maximum_size(Oid type_oid, int32 typemod); |