From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | pg_dump --if-exists --clean when drop index that is partition of a partitioned index |
Date: | 2025-04-14 05:54:09 |
Message-ID: | CACJufxF0QSdkjFKF4di-JGWN6CSdQYEAhGPmQJJCdkSZtd=oLg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
hi.
CREATE TABLE tp(c int, a int, b int) PARTITION BY RANGE (b);
CREATE TABLE tp_1(c int, a int, b int);
ALTER TABLE tp ATTACH PARTITION tp_1 FOR VALUES FROM (0) TO (1);
CREATE INDEX t_a_idx ON tp_1(a);
CREATE INDEX tp_a_idx ON tp(a);
pg_dump --schema=public --if-exists --clean --no-statistics
--no-owner --no-data --table-and-children=tp > 1.sql
pg_dump output file 1.sql excerpts:
----
DROP INDEX IF EXISTS public.t_a_idx;
DROP INDEX IF EXISTS public.tp_a_idx;
DROP TABLE IF EXISTS public.tp_1;
DROP TABLE IF EXISTS public.tp;
----
if you execute the
DROP INDEX IF EXISTS public.t_a_idx;
ERROR: cannot drop index t_a_idx because index tp_a_idx requires it
HINT: You can drop index tp_a_idx instead.
Is this pg_dump output what we expected?
SELECT * FROM pg_partition_tree('tp_a_idx');
relid | parentrelid | isleaf | level
----------+-------------+--------+-------
tp_a_idx | | f | 0
t_a_idx | tp_a_idx | t | 1
(2 rows)
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2025-04-14 06:09:03 | Re: pg_dump --if-exists --clean when drop index that is partition of a partitioned index |
Previous Message | vignesh C | 2025-04-14 05:38:22 | Re: New committer: Jacob Champion |