| From: | Ashwin Agrawal <ashwinstar(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | CREATE RULE may generate duplicate entries in pg_depend |
| Date: | 2020-08-26 21:39:53 |
| Message-ID: | CAKSySwf+ahKitw-QvDYs3j3orVL-eaBx=U0SN7SYamoL3toCyA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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);
# 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)
--
*Ashwin Agrawal (VMware)*
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2020-08-26 21:43:36 | Re: CREATE RULE may generate duplicate entries in pg_depend |
| Previous Message | Jim Nasby | 2020-08-26 21:22:51 | Typo in procarray.c comment about GlobalVisDataRels |