Re: pgsql: Fix pg_dumpall with database names containing =

From: Thom Brown <thom(at)linux(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
Cc: pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Fix pg_dumpall with database names containing =
Date: 2013-02-26 16:03:32
Message-ID: CAA-aLv5ZECCtzuBVWW8oB5yN0GCxFSNb9Eb1Onqj40fFxTRnxA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 20 February 2013 15:14, Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi> wrote:
> Fix pg_dumpall with database names containing =
>
> If a database name contained a '=' character, pg_dumpall failed. The problem
> was in the way pg_dumpall passes the database name to pg_dump on the
> command line. If it contained a '=' character, pg_dump would interpret it
> as a libpq connection string instead of a plain database name.
>
> To fix, pass the database name to pg_dump as a connection string,
> "dbname=foo", with the database name escaped if necessary.
>
> Back-patch to all supported branches.

I also notice that if you create a database with an "=" in, you can't
connect to it using psql.

thom(at)swift ~/Development/postgresql $ psql "8=8"
psql: invalid connection option "8"
thom(at)swift ~/Development/postgresql $ psql -d "8=8"
psql: invalid connection option "8"
thom(at)swift ~/Development/postgresql $ psql --dbname="8=8"
psql: invalid connection option "8"
thom(at)swift ~/Development/postgresql $ psql -d '8=8'
psql: invalid connection option "8"
thom(at)swift ~/Development/postgresql $ psql postgres
Expanded display is used automatically.
psql (9.3devel)
Type "help" for help.

postgres=# \c "8=8"
invalid connection option "8"
Previous connection kept
postgres=# \c 8=8
invalid connection option "8"
Previous connection kept

--
Thom

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2013-02-26 16:29:10 Re: pgsql: Fix pg_dumpall with database names containing =
Previous Message Peter Eisentraut 2013-02-25 23:04:23 pgsql: doc: Fix markup typo

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2013-02-26 16:23:01 Re: pg_xlogdump
Previous Message Fujii Masao 2013-02-26 15:34:54 pg_xlogdump compile error