CREATE RULE may generate duplicate entries in pg_depend
От | Ashwin Agrawal |
---|---|
Тема | CREATE RULE may generate duplicate entries in pg_depend |
Дата | |
Msg-id | CAKSySwf+ahKitw-QvDYs3j3orVL-eaBx=U0SN7SYamoL3toCyA@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: CREATE RULE may generate duplicate entries in pg_depend
|
Список | pgsql-hackers |
If action and qual reference same object in CREATE RULE, it results in creating duplicate entries in pg_depend for it. Doesn't pose any harm, just unnecessarily bloats pg_depend. Reference InsertRule(). I think should be able to avoid adding duplicate entries.
Don't know if this behaviour was discussed earlier, I didn't find it on search.
We accidentally encountered it while enhancing a catalog check tool for Greenplum Database.
For example (from rules test):
create table rtest_t5 (a int4, b text);
create table rtest_t7 (a int4, b text);
create rule rtest_t5_ins as on insert to rtest_t5
where new.a > 15 do
insert into rtest_t7 values (new.a, new.b);
create table rtest_t7 (a int4, b text);
create rule rtest_t5_ins as on insert to rtest_t5
where new.a > 15 do
insert into rtest_t7 values (new.a, new.b);
# select classid::regclass, refobjid::regclass,* from pg_depend where refobjid='rtest_t5'::regclass and deptype = 'n';
classid | refobjid | classid | objid | objsubid | refclassid | refobjid | refobjsubid | deptype
------------+----------+---------+-------+----------+------------+----------+-------------+---------
pg_rewrite | rtest_t5 | 2618 | 16457 | 0 | 1259 | 16445 | 1 | n
pg_rewrite | rtest_t5 | 2618 | 16457 | 0 | 1259 | 16445 | 1 | n
pg_rewrite | rtest_t5 | 2618 | 16457 | 0 | 1259 | 16445 | 2 | n
(3 rows)
classid | refobjid | classid | objid | objsubid | refclassid | refobjid | refobjsubid | deptype
------------+----------+---------+-------+----------+------------+----------+-------------+---------
pg_rewrite | rtest_t5 | 2618 | 16457 | 0 | 1259 | 16445 | 1 | n
pg_rewrite | rtest_t5 | 2618 | 16457 | 0 | 1259 | 16445 | 1 | n
pg_rewrite | rtest_t5 | 2618 | 16457 | 0 | 1259 | 16445 | 2 | n
(3 rows)
--
Ashwin Agrawal (VMware)
В списке pgsql-hackers по дате отправления: