Redundant error messages in policy.c

Started by Daniele Varrazzoover 10 years ago3 messages
#1Daniele Varrazzo
daniele.varrazzo@gmail.com
1 attachment(s)

There are 5 different strings (one has a whitespace error), they could
be 2. Patch attached.

postgresql/src/backend$ grep errmsg commands/policy.c | grep policy |
sed 's/^ *//'
errmsg("policy \"%s\" for relation \"%s\" already exists",
errmsg("policy \"%s\" on table \"%s\" does not exist",
errmsg("policy \"%s\" for table \"%s\" already exists",
errmsg("policy \"%s\" for table \"%s\" does not exist",
errmsg("policy \"%s\" for table \"%s\" does not exist",

-- Daniele

Attachments:

policy-messages.patchtext/x-patch; charset=US-ASCII; name=policy-messages.patchDownload
diff --git a/src/backend/commands/policy.c b/src/backend/commands/policy.c
index 6e95ba2..11efc9f 100644
--- a/src/backend/commands/policy.c
+++ b/src/backend/commands/policy.c
@@ -563,7 +563,7 @@ CreatePolicy(CreatePolicyStmt *stmt)
 	if (HeapTupleIsValid(policy_tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
-				 errmsg("policy \"%s\" for relation \"%s\" already exists",
+				 errmsg("policy \"%s\" for table \"%s\" already exists",
 				 stmt->policy_name, RelationGetRelationName(target_table))));
 
 	values[Anum_pg_policy_polrelid - 1] = ObjectIdGetDatum(table_id);
@@ -735,7 +735,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
 	if (!HeapTupleIsValid(policy_tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
-				 errmsg("policy \"%s\" on table \"%s\" does not exist",
+				 errmsg("policy \"%s\" for table \"%s\" does not exist",
 						stmt->policy_name,
 						RelationGetRelationName(target_table))));
 
@@ -977,7 +977,7 @@ get_relation_policy_oid(Oid relid, const char *policy_name, bool missing_ok)
 		if (!missing_ok)
 			ereport(ERROR,
 					(errcode(ERRCODE_UNDEFINED_OBJECT),
-					 errmsg("policy \"%s\" for table  \"%s\" does not exist",
+					 errmsg("policy \"%s\" for table \"%s\" does not exist",
 							policy_name, get_rel_name(relid))));
 
 		policy_oid = InvalidOid;
#2Stephen Frost
sfrost@snowman.net
In reply to: Daniele Varrazzo (#1)
Re: Redundant error messages in policy.c

Daniele,

* Daniele Varrazzo (daniele.varrazzo@gmail.com) wrote:

There are 5 different strings (one has a whitespace error), they could
be 2. Patch attached.

Fair point. I did try to address the language around policy vs. row
security vs. row level security, but didn't look as closely as I should
have at the error messages overall.

Will address.

Thanks!

Stephen

#3Joe Conway
mail@joeconway.com
In reply to: Stephen Frost (#2)
Re: Redundant error messages in policy.c

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/06/2015 02:26 PM, Stephen Frost wrote:

Daniele,

* Daniele Varrazzo (daniele.varrazzo@gmail.com) wrote:

There are 5 different strings (one has a whitespace error), they
could be 2. Patch attached.

Fair point. I did try to address the language around policy vs.
row security vs. row level security, but didn't look as closely as
I should have at the error messages overall.

Will address.

Pushed. Needed a small change to the expected regression output to match
.

Joe

- --
Joe Conway
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBAgAGBQJVm9t6AAoJEDfy90M199hlcXgP+wbk8YhPdlt18rtKdxMWF7OW
B+D05Rf09st+PmnqsWUtTgMjuukEgc7yFQMMmYWj2AWjLaoLaYX6C+7lBQ0ZDsyh
Ye2G9e/GHfkNc99bDIQ4QOQZo9l0+y9evlWfu+LJVcb9Ai108F9hk9fFm2m4OG9p
k7Kj79XxXBqoni8PTiqJ7X29uX2i6Zd0Zkah0AR87B+IjgzJJrKKEWUqiehTRLbb
5wkjaTiHfad06Bs9R/guMKSDzTqihBaC2yd34zemlItbqn3Ib7pZCjTJaV1s1bOO
9tae1j/uymmBxIot3Ys0LxebCb6i3uGa5F4rEk1q0f7NIa9wSdfDPcBjIqDsn2WY
yRNYCbFtVNXj4ehYLeGuz3zkjMGFQzq+7dJPuKkuHUBB50LCt93yQyMbxQ4YB3Fq
OOWZUsxfYOJM4uW8BvSltbq0PSqyo/I4/SJe6yweJsgAXXlzS8EkxMC17vGdr457
ERCSlxXESJ/+tL35GMiujsgSbQZMUu+fxe6bcH3zT4c1nbS8dEpHMm4G+Nojq6b8
pL9sB8txKc0utjVg63nb3oF3hPC25gXk9DHC8bOVUkp77o2TjhroixKvuTN+to+o
JLMseH06s7ZU69b8QNu1YtkeLPxOKZ7INHXSAZ6a2uXaRgNr8nMtJF+mSV0i9XlK
a1e9wR6QBq81PUMiZURN
=LgG6
-----END PGP SIGNATURE-----

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers