Re: Dropping a database that does not exist - Mailing list pgsql-general

From Uwe C. Schroeder
Subject Re: Dropping a database that does not exist
Date
Msg-id 200602100937.41314.uwe@oss4u.com
Whole thread Raw
In response to Dropping a database that does not exist  (Tham Shiming <shiming@misatravel.com>)
Responses Re: Dropping a database that does not exist  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I don't think you have duplicate databases - that would be the first time I
heard that postgreSQL supports that.
Are you sure you didn't create the database with a name that just doesn't
print?
I.e. a simple

createdb test

works.
do another

createdb "test "

(note the space)
works too, but when you list the db's you'll see test twice, although the one
of them is created with a space at the end, so you can't connect to it or
drop it unless you use quotes. Did you use some kind of tool that may have a
done this? Most tools use quotes when creating sql statements, so if you
accidentially added a space in the dialog you end up with a scenario like you
describe.


On Friday 10 February 2006 01:42, Tham Shiming wrote:
> Hi,
>
> I've been getting duplicate databases within my server. Dropping one of
> them works, but when I try to drop the other, psql will say that the
> database does not exist.
>
> For example:
>
> db1
> db1
> db2
> db3
> db4
> db4
> db5
>
> Running DROP DATABASE db1 for the first time works and I'm left with:
>
> db1
> db2
> db3
> db4
> db4
> db5
>
> Attempting to run DROP DATABASE db1 again will just give me "FATAL:
> database "db1" does not exist"
>
> Same scenario for db4.
>
> I could ignore the error, but because of the duplicate database, I
> cannot make a dump of the server.
>
> Any one has any ideas why this is happening and how I can solve it? A
> similar thing happened previously, but it was with tables within a
> database. The only way we solved that was by dropping the database and
> recreating the structure, which wasn't the ideal way I wanted to use.
> I've got PostgreSQL 8.0.4 running on SuSE 9.3.
>
> Regards,
> Shiming
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq

--
    UC

--
Open Source Solutions 4U, LLC    1618 Kelly St
Phone:  +1 707 568 3056        Santa Rosa, CA 95401
Cell:   +1 650 302 2405        United States
Fax:    +1 707 568 6416

pgsql-general by date:

Previous
From: Philippe Ferreira
Date:
Subject: Re: Tool
Next
From: Jean-Christophe Roux
Date:
Subject: ...