aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2019-08-05 07:48:41 -0700
committerNoah Misch <noah@leadboat.com>2019-08-05 07:48:45 -0700
commit752fa3dbfc36c70a692986b56daac41410fca3f6 (patch)
tree57569a9b106aa92376f0a11b2a23ac506a10f192 /src/backend/utils/adt/ruleutils.c
parent0e9e7e28902ca0a01b0d36cbdd155abe4ea63cfe (diff)
downloadpostgresql-752fa3dbfc36c70a692986b56daac41410fca3f6.tar.gz
postgresql-752fa3dbfc36c70a692986b56daac41410fca3f6.zip
Require the schema qualification in pg_temp.type_name(arg).
Commit aa27977fe21a7dfa4da4376ad66ae37cb8f0d0b5 introduced this restriction for pg_temp.function_name(arg); do likewise for types created in temporary schemas. Programs that this breaks should add "pg_temp." schema qualification or switch to arg::type_name syntax. Back-patch to 9.4 (all supported versions). Reviewed by Tom Lane. Reported by Tom Lane. Security: CVE-2019-10208
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
-rw-r--r--src/backend/utils/adt/ruleutils.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index bef01cde86e..9f7eb2ba9f2 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -8583,6 +8583,14 @@ get_coercion_expr(Node *arg, deparse_context *context,
if (!PRETTY_PAREN(context))
appendStringInfoChar(buf, ')');
}
+
+ /*
+ * Never emit resulttype(arg) functional notation. A pg_proc entry could
+ * take precedence, and a resulttype in pg_temp would require schema
+ * qualification that format_type_with_typemod() would usually omit. We've
+ * standardized on arg::resulttype, but CAST(arg AS resulttype) notation
+ * would work fine.
+ */
appendStringInfo(buf, "::%s",
format_type_with_typemod(resulttype, resulttypmod));
}