Re: Mysterious empty database name?

From: Azlin Rahim <azlin(dot)rahim(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Mysterious empty database name?
Date: 2010-05-25 23:09:00
Message-ID: AANLkTilIt0pqOYCcexDZjABbwunsHiBXxk37D6LYzHi-@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I tried to do another SELECT on pg_database with the OID and here's
what I get. Seems like there is no OID for the weird database. I'm
stumped.

Btw, our Postgresql version is 8.1.11.

# select oid,* from pg_database;
oid | datname | datdba | encoding |
datistemplate | datallowconn | datconnlimit | datlastsysoid |
datvacuumxid | datfrozenxid | dattablespace | datconfig |
datacl
--------+---------------------------+--------+----------+---------------+--------------+--------------+---------------+--------------+--------------+---------------+-----------+------------------------
10793 | postgres | 10 | 6 | f
| t | -1 | 10792 | 38260524 |
3259485997 | 1663 | |
138208 | jboss-ktj-2007-09-02 | 10 | 6 | f
| t | -1 | 10792 | 38260579 |
3259486052 | 1663 | |
134606 | jboss-ktj | 10 | 6 | f
| t | -1 | 10792 | 38261114 |
3259486587 | 1663 | |
208645 | jboss-ktj-test-2010-03-28 | 10 | 6 | f
| t | -1 | 10792 | 38261842 |
3259487315 | 1663 | |
185623 | jboss-warestore | 10 | 6 | f
| t | -1 | 10792 | 38262572 |
3259488045 | 1663 | |
1 | template1 | 10 | 6 | t
| t | -1 | 10792 | 38262629 |
3259488102 | 1663 | | {postgres=CT/postgres}
10792 | template0 | 10 | 6 | t
| f | -1 | 10792 | 499 |
499 | 1663 | | {postgres=CT/postgres}
245497 | jboss-ktj-test | 10 | 6 | f
| t | -1 | 10792 | 38262684 |
3259488157 | 1663 | |
| 10 | 6 | f | t |
-1 | 10792 | 499 | 499 | 1663 |
|
(9 rows)

On Wed, May 26, 2010 at 6:40 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> 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

--

Azlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-05-25 23:14:05 Re: Mysterious empty database name?
Previous Message Tim Landscheidt 2010-05-25 22:59:20 Re: How to fetch values at regular hours?