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
commit21f94c51f680cefa2ea6b0d94aa8a967a375afc6 (patch)
treeff1baabd21288b58c9fce838532df93be15cca47 /src/backend/utils/adt/ruleutils.c
parentb0fb44eacd8f96f48d3589f1a066fdd75947b4bd (diff)
downloadpostgresql-21f94c51f680cefa2ea6b0d94aa8a967a375afc6.tar.gz
postgresql-21f94c51f680cefa2ea6b0d94aa8a967a375afc6.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 74a18a146d0..364e465cbec 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -9400,6 +9400,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));
}