Re: Mysterious empty database name?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Azlin Rahim <azlin(dot)rahim(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Mysterious empty database name?
Date: 2010-05-25 22:40:00
Message-ID: 674.1274827200@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Azlin Rahim <azlin(dot)rahim(at)gmail(dot)com> writes:
> In our database list, there is one 'mysterious' database with a blank name.
> We don't know how it got there.

Your mail client has done you no favors as far as preserving the
formatting of the SELECT output, but it looks to me like the name of the
weird database is probably not blank but rather contains some control
characters (perhaps a carriage return?). Depending on how old your psql
is, that could result in wacky formatting, which is what it looks like
you've got here. Another theory is that it's an encoding problem:
non-ASCII database names are troublesome if you don't use the same
encoding in each database.

I'd suggest trying the SELECT under some other output format, perhaps
\pset format unaligned, to see if it gets any more readable.

Depending on what the name really is, you might be able to type it as a
double-quoted identifier, in which case ALTER DATABASE RENAME would
work to fix it. If all else fails, you could try getting the OID
of the database and then
UPDATE pg_database SET datname = 'something_sane' WHERE oid = nnn;
as superuser should fix it. (If it's pre-8.1 PG, you might need another
ALTER DATABASE RENAME to be sure subsidiary files are updated.)

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message alvherre 2010-05-25 22:41:59 Re: Mysterious empty database name?
Previous Message Azlin Rahim 2010-05-25 22:23:13 Mysterious empty database name?