Re: BUG #2333: dropdb ignores the database name argument

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: kevin barnes <vinbarnes(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2333: dropdb ignores the database name argument
Date: 2006-03-19 02:17:24
Message-ID: 20060319021724.GC883@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

kevin barnes wrote:

> In the 8.1 release on Unbuntu 5.10 there is an error with the dropdb command
> in /usr/bin. The error manifests itself by not respecting the DBNAME
> argument. It assumes that you want to connect to a database named 'postgres'
> and ignores whatever argument you give it. The error returned is:
>
> dropdb: database removal failed: ERROR: database "postgres" does not exist
>
> The error is actually correct, because I do not have a database named
> postgres, but the command does not work correctly.

I think what is happening here is that dropdb is trying to connect to
the postgres database to issue the DROP DATABASE command, and fails
because it doesn't exist. I thought it was fixed not long ago to retry
by connecting to template1 if postgres didn't exist; maybe it wasn't
really done and I'm misremembering, or maybe you're using a version
without the fix (and thus you should upgrade).

The obvious workaround is to create a database named postgres.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Meskes 2006-03-19 12:33:05 Re: BUG #2330: ECPGlib: Wrong error code in case of a duplicate key violation
Previous Message Bruce Momjian 2006-03-19 02:10:22 Re: BUG #2333: dropdb ignores the database name argument