Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 02eac01

Browse files
committed
Make RLS related error messages more consistent and compliant.
Also updated regression expected output to match. Noted and patch by Daniele Varrazzo.
1 parent 6c534fd commit 02eac01

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/backend/commands/policy.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ CreatePolicy(CreatePolicyStmt *stmt)
563563
if (HeapTupleIsValid(policy_tuple))
564564
ereport(ERROR,
565565
(errcode(ERRCODE_DUPLICATE_OBJECT),
566-
errmsg("policy \"%s\" for relation \"%s\" already exists",
566+
errmsg("policy \"%s\" for table \"%s\" already exists",
567567
stmt->policy_name, RelationGetRelationName(target_table))));
568568

569569
values[Anum_pg_policy_polrelid - 1] = ObjectIdGetDatum(table_id);
@@ -735,7 +735,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
735735
if (!HeapTupleIsValid(policy_tuple))
736736
ereport(ERROR,
737737
(errcode(ERRCODE_UNDEFINED_OBJECT),
738-
errmsg("policy \"%s\" on table \"%s\" does not exist",
738+
errmsg("policy \"%s\" for table \"%s\" does not exist",
739739
stmt->policy_name,
740740
RelationGetRelationName(target_table))));
741741

@@ -977,7 +977,7 @@ get_relation_policy_oid(Oid relid, const char *policy_name, bool missing_ok)
977977
if (!missing_ok)
978978
ereport(ERROR,
979979
(errcode(ERRCODE_UNDEFINED_OBJECT),
980-
errmsg("policy \"%s\" for table \"%s\" does not exist",
980+
errmsg("policy \"%s\" for table \"%s\" does not exist",
981981
policy_name, get_rel_name(relid))));
982982

983983
policy_oid = InvalidOid;

src/backend/commands/user.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ CreateRole(CreateRoleStmt *stmt)
301301
if (!superuser())
302302
ereport(ERROR,
303303
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
304-
errmsg("must be superuser to change bypassrls attribute.")));
304+
errmsg("must be superuser to change bypassrls attribute")));
305305
}
306306
else
307307
{

src/test/regress/expected/rowsecurity.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -1988,7 +1988,7 @@ GRANT ALL ON y1, y2 TO rls_regress_user1;
19881988
CREATE POLICY p1 ON y1 FOR ALL USING (a % 2 = 0);
19891989
CREATE POLICY p2 ON y1 FOR SELECT USING (a > 2);
19901990
CREATE POLICY p1 ON y1 FOR SELECT USING (a % 2 = 1); --fail
1991-
ERROR: policy "p1" for relation "y1" already exists
1991+
ERROR: policy "p1" for table "y1" already exists
19921992
CREATE POLICY p1 ON y2 FOR ALL USING (a % 2 = 0); --OK
19931993
ALTER TABLE y1 ENABLE ROW LEVEL SECURITY;
19941994
ALTER TABLE y2 ENABLE ROW LEVEL SECURITY;

0 commit comments

Comments
 (0)