Обсуждение: Drop Trigger Mechanism with Detached partitions

Поиск
Список
Период
Сортировка

Drop Trigger Mechanism with Detached partitions

От
M Beena Emerson
Дата:
Detach partition does not remove the partition trigger dependency as seen in below scenario.

rm44010_p had 2 partition p1 and p2 and p2 was detached.

A. Description of a partitioned table
\d+ rm44010_p
                           Partitioned table "public.rm44010_p"
 Column |  Type   | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
 c1     | integer |           |          |         | plain   |              |
 c2     | integer |           |          |         | plain   |              |
Partition key: RANGE (c2)
Triggers:
    rm44010_trig1 AFTER INSERT ON rm44010_p FOR EACH ROW EXECUTE FUNCTION trig_func()
Partitions: rm44010_p1 FOR VALUES FROM (1) TO (100)

B. Description of the detached partition still shows the trigger.
\d+ rm44010_p2
                                Table "public.rm44010_p2"
 Column |  Type   | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
 c1     | integer |           |          |         | plain   |              |
 c2     | integer |           |          |         | plain   |              |
Triggers:
    rm44010_trig1 AFTER INSERT ON rm44010_p2 FOR EACH ROW EXECUTE FUNCTION trig_func()
Access method: heap

C. Drop Trigger on partitioned table also removes the trigger on the detached partition.
DROP TRIGGER RM44010_trig1 ON RM44010_p;
DROP TRIGGER
\d+ rm44010_p2
                                Table "public.rm44010_p2"
 Column |  Type   | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
 c1     | integer |           |          |         | plain   |              |
 c2     | integer |           |          |         | plain   |              |
Access method: heap



--
Beena Emerson

EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Drop Trigger Mechanism with Detached partitions

От
Robert Haas
Дата:
On Mon, Sep 30, 2019 at 5:59 AM M Beena Emerson
<mbeena.emerson@gmail.com> wrote:
> Detach partition does not remove the partition trigger dependency as seen in below scenario.

Sounds like a bug.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company