mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Make RLS related error messages more consistent and compliant.
Also updated regression expected output to match. Noted and patch by Daniele Varrazzo.
This commit is contained in:
@ -563,7 +563,7 @@ CreatePolicy(CreatePolicyStmt *stmt)
|
|||||||
if (HeapTupleIsValid(policy_tuple))
|
if (HeapTupleIsValid(policy_tuple))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DUPLICATE_OBJECT),
|
(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))));
|
stmt->policy_name, RelationGetRelationName(target_table))));
|
||||||
|
|
||||||
values[Anum_pg_policy_polrelid - 1] = ObjectIdGetDatum(table_id);
|
values[Anum_pg_policy_polrelid - 1] = ObjectIdGetDatum(table_id);
|
||||||
@ -735,7 +735,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
|
|||||||
if (!HeapTupleIsValid(policy_tuple))
|
if (!HeapTupleIsValid(policy_tuple))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
(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,
|
stmt->policy_name,
|
||||||
RelationGetRelationName(target_table))));
|
RelationGetRelationName(target_table))));
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ CreateRole(CreateRoleStmt *stmt)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
errmsg("must be superuser to change bypassrls attribute.")));
|
errmsg("must be superuser to change bypassrls attribute")));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1988,7 +1988,7 @@ GRANT ALL ON y1, y2 TO rls_regress_user1;
|
|||||||
CREATE POLICY p1 ON y1 FOR ALL USING (a % 2 = 0);
|
CREATE POLICY p1 ON y1 FOR ALL USING (a % 2 = 0);
|
||||||
CREATE POLICY p2 ON y1 FOR SELECT USING (a > 2);
|
CREATE POLICY p2 ON y1 FOR SELECT USING (a > 2);
|
||||||
CREATE POLICY p1 ON y1 FOR SELECT USING (a % 2 = 1); --fail
|
CREATE POLICY p1 ON y1 FOR SELECT USING (a % 2 = 1); --fail
|
||||||
ERROR: policy "p1" for relation "y1" already exists
|
ERROR: policy "p1" for table "y1" already exists
|
||||||
CREATE POLICY p1 ON y2 FOR ALL USING (a % 2 = 0); --OK
|
CREATE POLICY p1 ON y2 FOR ALL USING (a % 2 = 0); --OK
|
||||||
ALTER TABLE y1 ENABLE ROW LEVEL SECURITY;
|
ALTER TABLE y1 ENABLE ROW LEVEL SECURITY;
|
||||||
ALTER TABLE y2 ENABLE ROW LEVEL SECURITY;
|
ALTER TABLE y2 ENABLE ROW LEVEL SECURITY;
|
||||||
|
Reference in New Issue
Block a user