MERGE PARTITIONS and DEPENDS ON EXTENSION.

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: MERGE PARTITIONS and DEPENDS ON EXTENSION.
Date: 2026-03-10 17:53:46
Message-ID: CALdSSPjXtzGM7Uk4fWRwRMXcCczge5uNirPQcYCHKPAWPkp9iQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Today, while reviewing another patch, I spotted PostgreSQL behaviour
which I cannot tell if is correct.

-- create relation
reshke=# create table pt (i int) partition by range ( i);
CREATE TABLE

-- create partitions.
reshke=# create table pt1 partition of pt for values from ( 1 ) to (2) ;
CREATE TABLE
reshke=# create table pt2 partition of pt for values from ( 2 ) to (3) ;
CREATE TABLE

-- manually add dependency on extension.
reshke=# alter index pt1_i_idx depends on extension btree_gist ;
ALTER INDEX
reshke=# alter index pt2_i_idx depends on extension btree_gist ;
ALTER INDEX

At this point, `drop extension btree_gist` fails due to existing
dependencies. However, after `alter table pt merge partitions ( pt1 ,
pt2 ) into pt3;` there are no dependencies, and drop extension
executes successfully.

My first impression was that there is no issue as the user created a
new database object, so should manually add dependency on extension.
However I am not 100% in this reasoning.

Any thoughts?

--
Best regards,
Kirill Reshke

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Woodward 2026-03-10 17:58:07 Re: Potential security risk associated with function call
Previous Message Mark Woodward 2026-03-10 17:42:58 Re: Potential security risk associated with function call