pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix pg_dumpall with database names containing =
9+ messages / 3 participants
[nested] [flat]

* pgsql: Fix pg_dumpall with database names containing =
@ 2013-02-20 15:14  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 1 reply; 9+ messages in thread

From: Heikki Linnakangas @ 2013-02-20 15:14 UTC (permalink / raw)
  To: pgsql-committers

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.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/957bafb2091136161cb7f1a8a56439310c6bd1b2

Modified Files
--------------
src/bin/pg_dump/pg_dumpall.c |   34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* pgsql: Fix pg_dumpall with database names containing =
@ 2013-02-20 15:14  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 9+ messages in thread

From: Heikki Linnakangas @ 2013-02-20 15:14 UTC (permalink / raw)
  To: pgsql-committers

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.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/8b4ced45ecbc63a5ffade472e7fc3316cd60bd7f

Modified Files
--------------
src/bin/pg_dump/pg_dumpall.c |   34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* pgsql: Fix pg_dumpall with database names containing =
@ 2013-02-20 15:14  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 9+ messages in thread

From: Heikki Linnakangas @ 2013-02-20 15:14 UTC (permalink / raw)
  To: pgsql-committers

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.

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/79f21b31074f3790320cb05e1e913360aba1053f

Modified Files
--------------
src/bin/pg_dump/pg_dumpall.c |   34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* pgsql: Fix pg_dumpall with database names containing =
@ 2013-02-20 15:14  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 9+ messages in thread

From: Heikki Linnakangas @ 2013-02-20 15:14 UTC (permalink / raw)
  To: pgsql-committers

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/f435cd1d385859a0cdb1d70fccc21dde2b1ee116

Modified Files
--------------
src/bin/pg_dump/pg_dumpall.c |   34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* pgsql: Fix pg_dumpall with database names containing =
@ 2013-02-20 15:14  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 9+ messages in thread

From: Heikki Linnakangas @ 2013-02-20 15:14 UTC (permalink / raw)
  To: pgsql-committers

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.

Branch
------
REL8_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/2aaa14d4218350756bc51ab623dbf1f43dbe3fc1

Modified Files
--------------
src/bin/pg_dump/pg_dumpall.c |   34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgsql: Fix pg_dumpall with database names containing =
@ 2013-02-26 16:03  Thom Brown <thom@linux.com>
  parent: Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 1 reply; 9+ messages in thread

From: Thom Brown @ 2013-02-26 16:03 UTC (permalink / raw)
  To: Heikki Linnakangas <heikki.linnakangas@iki.fi>; +Cc: pgsql-committers

On 20 February 2013 15:14, Heikki Linnakangas <heikki.linnakangas@iki.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@swift ~/Development/postgresql $ psql "8=8"
psql: invalid connection option "8"
thom@swift ~/Development/postgresql $ psql -d "8=8"
psql: invalid connection option "8"
thom@swift ~/Development/postgresql $ psql --dbname="8=8"
psql: invalid connection option "8"
thom@swift ~/Development/postgresql $ psql -d '8=8'
psql: invalid connection option "8"
thom@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


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgsql: Fix pg_dumpall with database names containing =
@ 2013-02-26 16:29  Heikki Linnakangas <hlinnakangas@vmware.com>
  parent: Thom Brown <thom@linux.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Heikki Linnakangas @ 2013-02-26 16:29 UTC (permalink / raw)
  To: Thom Brown <thom@linux.com>; +Cc: pgsql-committers

On 26.02.2013 18:03, Thom Brown wrote:
> On 20 February 2013 15:14, Heikki Linnakangas<heikki.linnakangas@iki.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.

Specifying it as a connection string works:

psql dbname='8=8'

That's the same trick I applied to pg_dumpall's pg_dump invocations.

- Heikki


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgsql: Fix pg_dumpall with database names containing =
@ 2013-02-27 09:52  Thom Brown <thom@linux.com>
  parent: Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Thom Brown @ 2013-02-27 09:52 UTC (permalink / raw)
  To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: pgsql-committers

On 26 February 2013 16:29, Heikki Linnakangas <hlinnakangas@vmware.com> wrote:
> On 26.02.2013 18:03, Thom Brown wrote:
>>
>> On 20 February 2013 15:14, Heikki Linnakangas<heikki.linnakangas@iki.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.
>
>
> Specifying it as a connection string works:
>
> psql dbname='8=8'
>
> That's the same trick I applied to pg_dumpall's pg_dump invocations.

Yes, but while this is true, it still seems like some kind of parsing
oversight.  Once I'm in that database, I can't switch user from within
psql:

8=8=# \c - moo
invalid connection option "8"
Previous connection kept

--
Thom


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: [COMMITTERS] pgsql: Fix pg_dumpall with database names containing =
@ 2013-02-27 12:54  Heikki Linnakangas <hlinnakangas@vmware.com>
  parent: Thom Brown <thom@linux.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Heikki Linnakangas @ 2013-02-27 12:54 UTC (permalink / raw)
  To: Thom Brown <thom@linux.com>; +Cc: PostgreSQL-development <pgsql-hackers@postgreSQL.org>

On 27.02.2013 11:52, Thom Brown wrote:
> Once I'm in that database, I can't switch user from within psql:
>
> 8=8=# \c - moo
> invalid connection option "8"
> Previous connection kept

Hmm, true. Also, any other connection options you specified in the 
original connection string are lost. For example, if you first connected 
with:

psql "dbname=foo sslmode=require"

and then did "\c - anotheruser", the second connection would not require 
ssl.

- Heikki


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2013-02-27 12:54 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-02-20 15:14 pgsql: Fix pg_dumpall with database names containing = Heikki Linnakangas <heikki.linnakangas@iki.fi>
2013-02-20 15:14 pgsql: Fix pg_dumpall with database names containing = Heikki Linnakangas <heikki.linnakangas@iki.fi>
2013-02-20 15:14 pgsql: Fix pg_dumpall with database names containing = Heikki Linnakangas <heikki.linnakangas@iki.fi>
2013-02-26 16:03 ` Thom Brown <thom@linux.com>
2013-02-26 16:29   ` Heikki Linnakangas <hlinnakangas@vmware.com>
2013-02-27 09:52     ` Thom Brown <thom@linux.com>
2013-02-27 12:54       ` Heikki Linnakangas <hlinnakangas@vmware.com>
2013-02-20 15:14 pgsql: Fix pg_dumpall with database names containing = Heikki Linnakangas <heikki.linnakangas@iki.fi>
2013-02-20 15:14 pgsql: Fix pg_dumpall with database names containing = Heikki Linnakangas <heikki.linnakangas@iki.fi>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox