From d5cb3bab564e0927ffac7c8729eacf181a12dd40 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 29 May 2017 21:48:26 -0400 Subject: [PATCH] Fix improper quoting of format_type_be() output. Per our message style guidelines, error messages incorporating the results of format_type_be() and its siblings should not add quotes around those results, because those functions already add quotes at need. Fix a few places that hadn't gotten that memo. --- src/backend/catalog/pg_aggregate.c | 2 +- src/backend/catalog/pg_constraint.c | 6 +++--- src/backend/commands/typecmds.c | 2 +- src/test/regress/output/constraints.source | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c index ac06823999..65c2e88e93 100644 --- a/src/backend/catalog/pg_aggregate.c +++ b/src/backend/catalog/pg_aggregate.c @@ -433,7 +433,7 @@ AggregateCreate(const char *aggName, if (aggTransType == INTERNALOID && func_strict(combinefn)) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("combine function with \"%s\" transition type must not be declared STRICT", + errmsg("combine function with transition type %s must not be declared STRICT", format_type_be(aggTransType)))); } diff --git a/src/backend/catalog/pg_constraint.c b/src/backend/catalog/pg_constraint.c index 62be80d800..e5ae3d9292 100644 --- a/src/backend/catalog/pg_constraint.c +++ b/src/backend/catalog/pg_constraint.c @@ -843,8 +843,8 @@ get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok) if (OidIsValid(conOid)) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("domain \"%s\" has multiple constraints named \"%s\"", - format_type_be(typid), conname))); + errmsg("domain %s has multiple constraints named \"%s\"", + format_type_be(typid), conname))); conOid = HeapTupleGetOid(tuple); } } @@ -855,7 +855,7 @@ get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok) if (!OidIsValid(conOid) && !missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("constraint \"%s\" for domain \"%s\" does not exist", + errmsg("constraint \"%s\" for domain %s does not exist", conname, format_type_be(typid)))); heap_close(pg_constraint, AccessShareLock); diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index c765e97fa8..e7ecc4ed7e 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -3162,7 +3162,7 @@ RenameType(RenameStmt *stmt) if (stmt->renameType == OBJECT_DOMAIN && typTup->typtype != TYPTYPE_DOMAIN) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("\"%s\" is not a domain", + errmsg("%s is not a domain", format_type_be(typeOid)))); /* diff --git a/src/test/regress/output/constraints.source b/src/test/regress/output/constraints.source index e6d3174380..bb75165cc2 100644 --- a/src/test/regress/output/constraints.source +++ b/src/test/regress/output/constraints.source @@ -684,7 +684,7 @@ COMMENT ON CONSTRAINT the_constraint ON DOMAIN constraint_comments_dom IS 'yes, COMMENT ON CONSTRAINT no_constraint ON constraint_comments_tbl IS 'yes, the comment'; ERROR: constraint "no_constraint" for table "constraint_comments_tbl" does not exist COMMENT ON CONSTRAINT no_constraint ON DOMAIN constraint_comments_dom IS 'yes, another comment'; -ERROR: constraint "no_constraint" for domain "constraint_comments_dom" does not exist +ERROR: constraint "no_constraint" for domain constraint_comments_dom does not exist -- no such table/domain COMMENT ON CONSTRAINT the_constraint ON no_comments_tbl IS 'bad comment'; ERROR: relation "no_comments_tbl" does not exist -- 2.40.0