Re: Mysterious empty database name? - Mailing list pgsql-general

From alvherre
Subject Re: Mysterious empty database name?
Date
Msg-id 1274826647-sup-4888@alvh.no-ip.org
Whole thread Raw
In response to Mysterious empty database name?  (Azlin Rahim <azlin.rahim@gmail.com>)
List pgsql-general
Excerpts from Azlin Rahim's message of mar may 25 18:23:13 -0400 2010:
> In our database list, there is one 'mysterious' database with a blank name.
> We don't know how it got there.

Maybe somebody SQL-injected you and created it.

> Below is the output of pg_database. Does anyone have any idea why this is
> happening? Any way to remove the 'mysterious' database safely.

I'd investigate a bit more what's inside, before deleting it.  Maybe the
name has only whitespace or control chars.  You can use double quotes to
refer to such names.  For example, this is a name a space and a
backspace:

 =# create database " ^?";
CREATE DATABASE


You can see the ASCII chars that make up the name with something like this:

 =# select datname, ascii(substring(datname, generate_series(1, length(datname)), 1)) from pg_database;

  \x7F      |    32
  \x7F      |   127

Now if somebody messed with an Unicode control char, I don't know what
to tell you.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Mysterious empty database name?
Next
From: Tim Landscheidt
Date:
Subject: Re: How to fetch values at regular hours?