BUG #13168: DROP DATABASE does not clean up all references - Mailing list pgsql-bugs

From cees.van.zeeland@xs4all.nl
Subject BUG #13168: DROP DATABASE does not clean up all references
Date
Msg-id 20150426214657.2548.8172@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #13168: DROP DATABASE does not clean up all references  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #13168: DROP DATABASE does not clean up all references  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      13168
Logged by:          Cees van Zeeland
Email address:      cees.van.zeeland@xs4all.nl
PostgreSQL version: 9.4.1
Operating system:   Windows 7 Home Edition 64 bit
Description:

-- Follow the next steps to produce an unexpected error
-- The next 16 lines work fine
CREATE DATABASE new
  WITH ENCODING='LATIN1'
       TEMPLATE=template0
       LC_COLLATE='C'
       LC_CTYPE='C'
       CONNECTION LIMIT=-1;

DROP TABLE IF EXISTS category CASCADE;
CREATE TABLE category
  (
     category_id SERIAL  PRIMARY KEY
    ,category_name varchar(30) NOT NULL
    ,category_description varchar(200) NOT NULL
  );

-- Now I am going to repeat the same script without DROP TABLE
-- After the next line, I assume that all old references within the database
are gone
DROP DATABASE new;

CREATE DATABASE new
  WITH ENCODING='LATIN1'
       TEMPLATE=template0
       LC_COLLATE='C'
       LC_CTYPE='C'
       CONNECTION LIMIT=-1;

-- Here I leave out the line with DROP TABLE
-- It results to the error message:
-- ERROR: relation "category" already exists
-- Is this a bug or am I missing something?
-- DROP TABLE IF EXISTS category CASCADE;

CREATE TABLE category
  (
     category_id SERIAL  PRIMARY KEY
    ,category_name varchar(30) NOT NULL
    ,category_description varchar(200) NOT NULL
  );

DROP DATABASE new;

-- In fact I can repeat this script
-- first time: no error
-- second time: with error

pgsql-bugs by date:

Previous
From: me@andrewray.me
Date:
Subject: BUG #13160: Incorrect escaping of quotes in JSON export
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #13143: Cannot stop and restart a streaming server with a replication slot