Re: Error in ALTER DATABASE command

From: William Garrison <mobydisk(at)mobydisk(dot)com>
To: Postgres General List <pgsql-general(at)postgresql(dot)org>
Cc: Douglas McNaught <doug(at)mcnaught(dot)org>, William Garrison <postgres(at)mobydisk(dot)com>, rod(at)iol(dot)ie, scrawford(at)pinpointresearch(dot)com
Subject: Re: Error in ALTER DATABASE command
Date: 2008-09-23 16:58:29
Message-ID: 48D92035.2040703@mobydisk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I found out about the quoting thing about 30 seconds after I made the
post. :) Thanks everyone who replied.

Douglas McNaught wrote:
> On Tue, Sep 23, 2008 at 11:49 AM, William Garrison
> <postgres(at)mobydisk(dot)com> wrote:
>
>> In Postgresql 8.2.9 on Windows, you cannot rename a database if the name
>> contains mixed case.
>>
>
>
>> 3) Open a query window, or use PSQL to issue the following command
>> ALTER DATABASE MixedCase RENAME TO anything_else;
>> PostgreSQL will respond with:
>> ERROR: database "mixedcase" does not exist
>> SQL state: 3D000
>>
>
> You need to quote the identifier using double-quotes to avoid
> case-folding (this is a general rule):
>
> ALTER DATABASE "MixedCase" RENAME TO anything_else;
>
>
>> Postgresql seems to force many things to lower case.
>>
>
> Yes, it's actually a variation on the SQL standard, which specifies
> forcing to upper case (as Oracle does).
>
>
>> Is it a bug that the
>> admin tool lets you create a database with mixed case names?
>>
>
> The admin tool is a separate project and works by its own rules.
>
>
>> Or is it a bug
>> that you cannot rename them thereafter?
>>
>
> The FAQ has a good section on identifier case-folding and quoting, I
> think. Probably worth a read.
>
> -Doug
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message William Garrison 2008-09-23 17:03:25 pg_dump | pg_sql: insert commands and foreign key constraints
Previous Message Steve Crawford 2008-09-23 15:59:58 Re: Error in ALTER DATABASE command