Re: BUG #15853: DROP TABLE CASCADE drops sequence that other tables depend on

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "wondertx(at)gmail(dot)com" <wondertx(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #15853: DROP TABLE CASCADE drops sequence that other tables depend on
Date: 2019-06-15 11:35:49
Message-ID: CAKFQuwZQBSttVxNWGa1tRdnT8xxtXJdfbFxbYVFVHUSw5oLkfA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Saturday, June 15, 2019, PG Bug reporting form <noreply(at)postgresql(dot)org>
wrote:

> The following bug has been logged on the website:
>
> Bug reference: 15853
> Logged by: wondertx
> Email address: wondertx(at)gmail(dot)com
> PostgreSQL version: 11.3
> Operating system: Arch Linux
> Description:
>
> The following SQL executed will drop the sequence `t_id_seq`:
> CREATE TABLE t(id SERIAL, value INT NOT NULL);
> CREATE TABLE t_bak LIKE t INCLUDING DEFAULTS INCLUDING INDEXES INCLUDING
> COMMENTS INCLUDING CONSTRAINTS);
> DROP TABLE t CASCADE;
> This will drop default value of column `value` in t_bak.
> However, the following SQL will not drop the sequence:
> CREATE TABLE t(id SERIAL, value INT NOT NULL);
> DROP SEQUENCE t_id_seq;
> CREATE SEQUENCE t_id_seq;
> ALTER TABLE T ALTER COLUMN ID SET DEFAULT NEXTVAL('t_id_seq'::regclass);
> CREATE TABLE t_bak LIKE t INCLUDING DEFAULTS INCLUDING INDEXES INCLUDING
> COMMENTS INCLUDING CONSTRAINTS);
> DROP TABLE t CASCADE;
>
>
From what i understand this behavior is documented. What is it that you
expect to happen?

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Luca Ferrari 2019-06-15 12:03:41 Re: Recursive CTE and collation
Previous Message PG Bug reporting form 2019-06-15 08:47:16 BUG #15853: DROP TABLE CASCADE drops sequence that other tables depend on