v59_amit_2.txt
text/plain
Filename: v59_amit_2.txt
Type: text/plain
Part: 0
diff --git a/src/backend/commands/policy.c b/src/backend/commands/policy.c
index 10ea599bac0..ebab2edde92 100644
--- a/src/backend/commands/policy.c
+++ b/src/backend/commands/policy.c
@@ -86,8 +86,8 @@ RangeVarCallbackForPolicy(const RangeVar *rv, Oid relid, Oid oldrelid,
*/
if (IsConflictLogTableClass(classform))
ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied: \"%s\" is a conflict log table",
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot create policy on conflict log table \"%s\"",
rv->relname),
errdetail("Conflict log tables are system-managed tables for logical replication conflicts.")));
diff --git a/src/backend/commands/statscmds.c b/src/backend/commands/statscmds.c
index e8fa81ef555..ce98ebb35ea 100644
--- a/src/backend/commands/statscmds.c
+++ b/src/backend/commands/statscmds.c
@@ -156,8 +156,8 @@ CreateStatistics(CreateStatsStmt *stmt, bool check_rights)
*/
if (IsConflictLogTableClass(rel->rd_rel))
ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied: \"%s\" is a conflict log table",
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot create statistics on conflict log table \"%s\"",
RelationGetRelationName(rel)),
errdetail("Conflict log tables are system-managed tables for logical replication conflicts.")));
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index a3cda01d80f..47dafc0dba8 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -2764,8 +2764,8 @@ MergeAttributes(List *columns, const List *supers, char relpersistence,
*/
if (IsConflictLogTableNamespace(relation->rd_rel->relnamespace))
ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied: cannot inherit from conflict log table \"%s\"",
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot inherit from conflict log table \"%s\"",
RelationGetRelationName(relation)),
errdetail("Conflict log tables are system-managed tables for logical replication conflicts.")));
@@ -3914,8 +3914,8 @@ renameatt_check(Oid myrelid, Form_pg_class classform, bool recursing)
*/
if (IsConflictLogTableClass(classform))
ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied: \"%s\" is a conflict log table",
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot rename columns of conflict log table \"%s\"",
NameStr(classform->relname)),
errdetail("Conflict log tables are system-managed tables for logical replication conflicts.")));
@@ -6932,8 +6932,8 @@ ATSimplePermissions(AlterTableType cmdtype, Relation rel, int allowed_targets)
*/
if (IsConflictLogTableClass(rel->rd_rel))
ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied: \"%s\" is a conflict log table",
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot alter conflict log table \"%s\"",
RelationGetRelationName(rel)),
errdetail("Conflict log tables are system-managed tables for logical replication conflicts.")));
@@ -10253,8 +10253,8 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
*/
if (IsConflictLogTableClass(pkrel->rd_rel))
ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied: \"%s\" is a conflict log table",
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot reference conflict log table \"%s\"",
RelationGetRelationName(pkrel)),
errdetail("Conflict log tables are system-managed tables for logical replication conflicts.")));
@@ -20101,8 +20101,8 @@ RangeVarCallbackOwnsRelation(const RangeVar *relation,
*/
if (IsConflictLogTableClass((Form_pg_class) GETSTRUCT(tuple)))
ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied: \"%s\" is a conflict log table",
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot change conflict log table \"%s\"",
relation->relname),
errdetail("Conflict log tables are system-managed tables for logical replication conflicts.")));
@@ -20148,8 +20148,8 @@ RangeVarCallbackForAlterRelation(const RangeVar *rv, Oid relid, Oid oldrelid,
*/
if (IsConflictLogTableClass(classform))
ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied: \"%s\" is a conflict log table",
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot alter conflict log table \"%s\"",
rv->relname),
errdetail("Conflict log tables are system-managed tables for logical replication conflicts.")));
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index de7957a15f7..00d3c90b599 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -321,8 +321,8 @@ CreateTriggerFiringOn(const CreateTrigStmt *stmt, const char *queryString,
*/
if (IsConflictLogTableClass(rel->rd_rel))
ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied: \"%s\" is a conflict log table",
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot create trigger on conflict log table \"%s\"",
RelationGetRelationName(rel)),
errdetail("Conflict log tables are system-managed tables for logical replication conflicts.")));
@@ -1463,8 +1463,8 @@ RangeVarCallbackForRenameTrigger(const RangeVar *rv, Oid relid, Oid oldrelid,
*/
if (IsConflictLogTableClass(form))
ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied: \"%s\" is a conflict log table",
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot rename trigger on conflict log table \"%s\"",
rv->relname),
errdetail("Conflict log tables are system-managed tables for logical replication conflicts.")));
diff --git a/src/backend/rewrite/rewriteDefine.c b/src/backend/rewrite/rewriteDefine.c
index d00d76613a1..968ed8ccfce 100644
--- a/src/backend/rewrite/rewriteDefine.c
+++ b/src/backend/rewrite/rewriteDefine.c
@@ -268,8 +268,8 @@ DefineQueryRewrite(const char *rulename,
*/
if (IsConflictLogTableClass(event_relation->rd_rel))
ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied: \"%s\" is a conflict log table",
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("conflict log table \"%s\" cannot have rules",
RelationGetRelationName(event_relation)),
errdetail("Conflict log tables are system-managed tables for logical replication conflicts.")));
@@ -789,8 +789,8 @@ RangeVarCallbackForRenameRule(const RangeVar *rv, Oid relid, Oid oldrelid,
*/
if (IsConflictLogTableClass(form))
ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied: \"%s\" is a conflict log table",
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("conflict log table \"%s\" cannot have rules",
rv->relname),
errdetail("Conflict log tables are system-managed tables for logical replication conflicts.")));
diff --git a/src/test/regress/expected/subscription.out b/src/test/regress/expected/subscription.out
index 6f1b2c47a6d..5dc5ebfd2a9 100644
--- a/src/test/regress/expected/subscription.out
+++ b/src/test/regress/expected/subscription.out
@@ -851,11 +851,11 @@ BEGIN
RAISE NOTICE 'Attempting ALTER TABLE on conflict log table';
EXECUTE 'ALTER TABLE ' || tab_name || ' ADD COLUMN extra_info text';
-EXCEPTION WHEN insufficient_privilege THEN
- RAISE NOTICE 'captured expected error: insufficient_privilege during ALTER';
+EXCEPTION WHEN wrong_object_type THEN
+ RAISE NOTICE 'captured expected error: wrong_object_type during ALTER';
END $$;
NOTICE: Attempting ALTER TABLE on conflict log table
-NOTICE: captured expected error: insufficient_privilege during ALTER
+NOTICE: captured expected error: wrong_object_type during ALTER
-- Test Manual INSERT on conflict log table
-- This should fail because the table is system-managed
-- Hiding the OID in the error message by catching the exception
@@ -925,13 +925,13 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'CREATE POLICY p1 ON ' || tab_name || ' USING (true)';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Policy error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
regexp_replace(err_detail, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx');
END $$;
-NOTICE: Policy error: permission denied: "pg_conflict_log_xxx" is a conflict log table, detail: Conflict log tables are system-managed tables for logical replication conflicts.
+NOTICE: Policy error: cannot create policy on conflict log table "pg_conflict_log_xxx", detail: Conflict log tables are system-managed tables for logical replication conflicts.
-- Statistics on conflict log table
DO $$
DECLARE
@@ -943,13 +943,13 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'CREATE STATISTICS s1 ON relname, schemaname FROM ' || tab_name;
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Statistics error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
regexp_replace(err_detail, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx');
END $$;
-NOTICE: Statistics error: permission denied: "pg_conflict_log_xxx" is a conflict log table, detail: Conflict log tables are system-managed tables for logical replication conflicts.
+NOTICE: Statistics error: cannot create statistics on conflict log table "pg_conflict_log_xxx", detail: Conflict log tables are system-managed tables for logical replication conflicts.
-- Inheritance from conflict log table
DO $$
DECLARE
@@ -961,13 +961,13 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'CREATE TABLE public.conflict_child () INHERITS (' || tab_name || ')';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Inheritance error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
regexp_replace(err_detail, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx');
END $$;
-NOTICE: Inheritance error: permission denied: cannot inherit from conflict log table "pg_conflict_log_xxx", detail: Conflict log tables are system-managed tables for logical replication conflicts.
+NOTICE: Inheritance error: cannot inherit from conflict log table "pg_conflict_log_xxx", detail: Conflict log tables are system-managed tables for logical replication conflicts.
-- Column rename on conflict log table
DO $$
DECLARE
@@ -979,13 +979,13 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'ALTER TABLE ' || tab_name || ' RENAME COLUMN relname TO new_relname';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Column rename error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
regexp_replace(err_detail, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx');
END $$;
-NOTICE: Column rename error: permission denied: "pg_conflict_log_xxx" is a conflict log table, detail: Conflict log tables are system-managed tables for logical replication conflicts.
+NOTICE: Column rename error: cannot rename columns of conflict log table "pg_conflict_log_xxx", detail: Conflict log tables are system-managed tables for logical replication conflicts.
-- Foreign key reference to conflict log table
DO $$
DECLARE
@@ -997,13 +997,13 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'CREATE TABLE public.conflict_fk (relname text REFERENCES ' || tab_name || '(relname))';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Foreign key error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
regexp_replace(err_detail, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx');
END $$;
-NOTICE: Foreign key error: permission denied: "pg_conflict_log_xxx" is a conflict log table, detail: Conflict log tables are system-managed tables for logical replication conflicts.
+NOTICE: Foreign key error: cannot reference conflict log table "pg_conflict_log_xxx", detail: Conflict log tables are system-managed tables for logical replication conflicts.
-- Alter table owner
DO $$
DECLARE
@@ -1015,13 +1015,13 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'ALTER TABLE ' || tab_name || ' OWNER TO regress_subscription_user_dummy';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Alter owner error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
regexp_replace(err_detail, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx');
END $$;
-NOTICE: Alter owner error: permission denied: "pg_conflict_log_xxx" is a conflict log table, detail: Conflict log tables are system-managed tables for logical replication conflicts.
+NOTICE: Alter owner error: cannot alter conflict log table "pg_conflict_log_xxx", detail: Conflict log tables are system-managed tables for logical replication conflicts.
-- Alter table schema
DO $$
DECLARE
@@ -1033,13 +1033,13 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'ALTER TABLE ' || tab_name || ' SET SCHEMA public';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Alter schema error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
regexp_replace(err_detail, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx');
END $$;
-NOTICE: Alter schema error: permission denied: "pg_conflict_log_xxx" is a conflict log table, detail: Conflict log tables are system-managed tables for logical replication conflicts.
+NOTICE: Alter schema error: cannot alter conflict log table "pg_conflict_log_xxx", detail: Conflict log tables are system-managed tables for logical replication conflicts.
-- Create trigger on conflict log table
DO $$
DECLARE
@@ -1051,13 +1051,13 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'CREATE TRIGGER t1 BEFORE INSERT ON ' || tab_name || ' FOR EACH ROW EXECUTE FUNCTION public.dummy_trigger_func()';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Create trigger error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
regexp_replace(err_detail, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx');
END $$;
-NOTICE: Create trigger error: permission denied: "pg_conflict_log_xxx" is a conflict log table, detail: Conflict log tables are system-managed tables for logical replication conflicts.
+NOTICE: Create trigger error: cannot create trigger on conflict log table "pg_conflict_log_xxx", detail: Conflict log tables are system-managed tables for logical replication conflicts.
-- Rename trigger on conflict log table
DO $$
DECLARE
@@ -1069,13 +1069,13 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'ALTER TRIGGER non_existent_trigger ON ' || tab_name || ' RENAME TO new_trigger';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Rename trigger error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
regexp_replace(err_detail, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx');
END $$;
-NOTICE: Rename trigger error: permission denied: "pg_conflict_log_xxx" is a conflict log table, detail: Conflict log tables are system-managed tables for logical replication conflicts.
+NOTICE: Rename trigger error: cannot rename trigger on conflict log table "pg_conflict_log_xxx", detail: Conflict log tables are system-managed tables for logical replication conflicts.
-- Create rule on conflict log table
DO $$
DECLARE
@@ -1087,13 +1087,13 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'CREATE RULE r1 AS ON INSERT TO ' || tab_name || ' DO INSTEAD NOTHING';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Create rule error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
regexp_replace(err_detail, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx');
END $$;
-NOTICE: Create rule error: permission denied: "pg_conflict_log_xxx" is a conflict log table, detail: Conflict log tables are system-managed tables for logical replication conflicts.
+NOTICE: Create rule error: conflict log table "pg_conflict_log_xxx" cannot have rules, detail: Conflict log tables are system-managed tables for logical replication conflicts.
-- Rename rule on conflict log table
DO $$
DECLARE
@@ -1105,13 +1105,13 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'ALTER RULE non_existent_rule ON ' || tab_name || ' RENAME TO new_rule';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Rename rule error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
regexp_replace(err_detail, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx');
END $$;
-NOTICE: Rename rule error: permission denied: "pg_conflict_log_xxx" is a conflict log table, detail: Conflict log tables are system-managed tables for logical replication conflicts.
+NOTICE: Rename rule error: conflict log table "pg_conflict_log_xxx" cannot have rules, detail: Conflict log tables are system-managed tables for logical replication conflicts.
-- Create index on conflict log table
DO $$
DECLARE
@@ -1123,13 +1123,13 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'CREATE INDEX idx1 ON ' || tab_name || ' (relname)';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Create index error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
regexp_replace(err_detail, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx');
END $$;
-NOTICE: Create index error: permission denied: "pg_conflict_log_xxx" is a conflict log table, detail: Conflict log tables are system-managed tables for logical replication conflicts.
+NOTICE: Create index error: cannot change conflict log table "pg_conflict_log_xxx", detail: Conflict log tables are system-managed tables for logical replication conflicts.
-- fail - conflict log table cannot be added to a publication
DO $$
DECLARE
diff --git a/src/test/regress/sql/subscription.sql b/src/test/regress/sql/subscription.sql
index 084e5e7e78f..503c9ceb272 100644
--- a/src/test/regress/sql/subscription.sql
+++ b/src/test/regress/sql/subscription.sql
@@ -654,8 +654,8 @@ BEGIN
RAISE NOTICE 'Attempting ALTER TABLE on conflict log table';
EXECUTE 'ALTER TABLE ' || tab_name || ' ADD COLUMN extra_info text';
-EXCEPTION WHEN insufficient_privilege THEN
- RAISE NOTICE 'captured expected error: insufficient_privilege during ALTER';
+EXCEPTION WHEN wrong_object_type THEN
+ RAISE NOTICE 'captured expected error: wrong_object_type during ALTER';
END $$;
-- Test Manual INSERT on conflict log table
@@ -727,7 +727,7 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'CREATE POLICY p1 ON ' || tab_name || ' USING (true)';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Policy error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
@@ -745,7 +745,7 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'CREATE STATISTICS s1 ON relname, schemaname FROM ' || tab_name;
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Statistics error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
@@ -763,7 +763,7 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'CREATE TABLE public.conflict_child () INHERITS (' || tab_name || ')';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Inheritance error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
@@ -781,7 +781,7 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'ALTER TABLE ' || tab_name || ' RENAME COLUMN relname TO new_relname';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Column rename error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
@@ -799,7 +799,7 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'CREATE TABLE public.conflict_fk (relname text REFERENCES ' || tab_name || '(relname))';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Foreign key error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
@@ -817,7 +817,7 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'ALTER TABLE ' || tab_name || ' OWNER TO regress_subscription_user_dummy';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Alter owner error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
@@ -835,7 +835,7 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'ALTER TABLE ' || tab_name || ' SET SCHEMA public';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Alter schema error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
@@ -853,7 +853,7 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'CREATE TRIGGER t1 BEFORE INSERT ON ' || tab_name || ' FOR EACH ROW EXECUTE FUNCTION public.dummy_trigger_func()';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Create trigger error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
@@ -871,7 +871,7 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'ALTER TRIGGER non_existent_trigger ON ' || tab_name || ' RENAME TO new_trigger';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Rename trigger error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
@@ -889,7 +889,7 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'CREATE RULE r1 AS ON INSERT TO ' || tab_name || ' DO INSTEAD NOTHING';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Create rule error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
@@ -907,7 +907,7 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'ALTER RULE non_existent_rule ON ' || tab_name || ' RENAME TO new_rule';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Rename rule error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
@@ -925,7 +925,7 @@ BEGIN
FROM pg_class c JOIN pg_subscription s ON c.relname = 'pg_conflict_log_' || s.oid
WHERE s.subname = 'regress_conflict_protection_test';
EXECUTE 'CREATE INDEX idx1 ON ' || tab_name || ' (relname)';
-EXCEPTION WHEN insufficient_privilege THEN
+EXCEPTION WHEN wrong_object_type THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT, err_detail = PG_EXCEPTION_DETAIL;
RAISE NOTICE 'Create index error: %, detail: %',
regexp_replace(err_msg, 'pg_conflict_log_\d+', 'pg_conflict_log_xxx'),
diff --git a/src/test/subscription/t/035_conflicts.pl b/src/test/subscription/t/035_conflicts.pl
index 4260c4a5803..3c2d2debf54 100644
--- a/src/test/subscription/t/035_conflicts.pl
+++ b/src/test/subscription/t/035_conflicts.pl
@@ -724,7 +724,7 @@ ok( $node_A->poll_query_until(
"ALTER TABLE $clt SET TABLESPACE pg_default");
like(
$stderr,
- qr/permission denied: "pg_conflict_log_\d+" is a conflict log table/,
+ qr/cannot alter conflict log table "pg_conflict_log_\d+"/,
"moving a conflict log table with ALTER TABLE SET TABLESPACE is rejected");
###############################################################################