pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #13168: DROP DATABASE does not clean up all references
3+ messages / 3 participants
[nested] [flat]
* BUG #13168: DROP DATABASE does not clean up all references
@ 2015-04-26 21:46 cees.van.zeeland@xs4all.nl
0 siblings, 2 replies; 3+ messages in thread
From: cees.van.zeeland@xs4all.nl @ 2015-04-26 21:46 UTC (permalink / raw)
To: 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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #13168: DROP DATABASE does not clean up all references
@ 2015-04-27 16:23 Tom Lane <tgl@sss.pgh.pa.us>
parent: cees.van.zeeland@xs4all.nl
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2015-04-27 16:23 UTC (permalink / raw)
To: cees.van.zeeland@xs4all.nl; +Cc: pgsql-bugs
cees.van.zeeland@xs4all.nl writes:
> -- 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
> );
AFAICS you didn't reconnect to database "new", so table "category" is
in whatever database you connected to originally.
> DROP DATABASE new;
If you had reconnected, it would not have allowed you to drop the current
database ...
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #13168: DROP DATABASE does not clean up all references
@ 2015-04-27 16:24 David G. Johnston <david.g.johnston@gmail.com>
parent: cees.van.zeeland@xs4all.nl
1 sibling, 0 replies; 3+ messages in thread
From: David G. Johnston @ 2015-04-27 16:24 UTC (permalink / raw)
To: cees.van.zeeland@xs4all.nl; +Cc: pgsql-bugs
On Sun, Apr 26, 2015 at 2:46 PM, <cees.van.zeeland@xs4all.nl> wrote:
> 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
>
You are connected to the "postgres" database (probably, maybe template1...)
> CREATE DATABASE new
> WITH ENCODING='LATIN1'
> TEMPLATE=template0
> LC_COLLATE='C'
> LC_CTYPE='C'
> CONNECTION LIMIT=-1;
>
>
You are still connected to "postgres"...
> 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
> );
>
>
Table "category" exists now in Database "postgres"
-- 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;
>
>
So you dropped an added the "new" database again...while connected to
"postgres".
CREATE TABLE category
> (
> category_id SERIAL PRIMARY KEY
> ,category_name varchar(30) NOT NULL
> ,category_description varchar(200) NOT NULL
> );
>
>
Of course the table you created in Database "postgres" is still there...
David J.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2015-04-27 16:24 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-04-26 21:46 BUG #13168: DROP DATABASE does not clean up all references cees.van.zeeland@xs4all.nl
2015-04-27 16:23 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-04-27 16:24 ` David G. Johnston <david.g.johnston@gmail.com>
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