Re: [HACKERS] dropping partitioned tables without CASCADE - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: [HACKERS] dropping partitioned tables without CASCADE
Date
Msg-id CAFjFpRepJgqbjf+FX7xfLP3YXDcoLSmR6m3SX0SJyVKG2GW-Pg@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] dropping partitioned tables without CASCADE  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: [HACKERS] dropping partitioned tables without CASCADE  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-hackers
>
> I used a slight modification of the case mentioned on the docs. I
> confirm this fails repeatably for me on current HEAD.
>
> CREATE TABLE cities (
>      city_id      bigserial not null,
>      name         text not null,
>      population   bigint
> ) PARTITION BY LIST (left(lower(name), 1));
>
> CREATE TABLE cities_ab
> PARTITION OF cities (
>   CONSTRAINT city_id_nonzero CHECK (city_id != 0)
> ) FOR VALUES IN ('a', 'b')
> PARTITION BY RANGE (population);
>
> drop table cities;
> ERROR:  cannot drop table cities because other objects depend on it
> DETAIL:  table cities_ab depends on table cities
> HINT:  Use DROP ... CASCADE to drop the dependent objects too.

I think that's what this patch fixes. Do you see this behaviour after
applying the patch?

>
> I notice also that
>   \d+ <tablename>
> does not show which partitions have subpartitions.

I will confirm this once I have access to the code.

>
> I'm worried that these things illustrate something about the catalog
> representation that we may need to improve, but I don't have anything
> concrete to say on that at present.

AFAIK, catalogs have everything needed to fix this; it's just the
matter to using that information wherever it's needed.
-- 
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: [HACKERS] Measuring replay lag
Next
From: Pavel Stehule
Date:
Subject: Re: [HACKERS] patch: function xmltable