pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: wondertx@gmail.com
Subject: BUG #15853: DROP TABLE CASCADE drops sequence that other tables depend on
Date: Sat, 15 Jun 2019 08:47:16 +0000
Message-ID: <15853-b83a5170b0267679@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15853
Logged by:          wondertx
Email address:      wondertx@gmail.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;



view thread (5+ messages)  latest in thread

Message-ID: <15853-b83a5170b0267679@postgresql.org>
Permalink:  ../15853-b83a5170b0267679@postgresql.org/
Also on:    postgresql.org/message-id/15853-b83a5170b0267679@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, wondertx@gmail.com
  Subject: Re: BUG #15853: DROP TABLE CASCADE drops sequence that other tables depend on
  In-Reply-To: <15853-b83a5170b0267679@postgresql.org>
  References: <15853-b83a5170b0267679@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox