pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_dumpall fails if a database name contains =
2+ messages / 1 participants
[nested] [flat]

* pg_dumpall fails if a database name contains =
@ 2013-02-20 14:19  Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 1 reply; 2+ messages in thread

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

~/pgsql.92stable$ bin/createdb "foo=bar"
~/pgsql.92stable$ bin/pg_dumpall > /dev/null
pg_dump: [archiver (db)] connection to database "(null)" failed: invalid 
connection option "foo"
pg_dumpall: pg_dump failed on database "foo=bar", exiting

There are two bugs above:

1. When pg_dumpall passes the database name to pg_dump as a command line 
argument, pg_dump interprets it as a connection string if it contains =.

2. When you pass an invalid connection string to pg_dump, it passes a 
NULL pointer to printf when constructing the error message. It shows as 
"(null)" above, but would segfault on other platforms.

- Heikki


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



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

* Re: pg_dumpall fails if a database name contains =
@ 2013-02-20 15:17  Heikki Linnakangas <hlinnakangas@vmware.com>
  parent: Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 0 replies; 2+ messages in thread

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

On 20.02.2013 16:19, Heikki Linnakangas wrote:
> ~/pgsql.92stable$ bin/createdb "foo=bar"
> ~/pgsql.92stable$ bin/pg_dumpall > /dev/null
> pg_dump: [archiver (db)] connection to database "(null)" failed: invalid
> connection option "foo"
> pg_dumpall: pg_dump failed on database "foo=bar", exiting
>
> There are two bugs above:
>
> 1. When pg_dumpall passes the database name to pg_dump as a command line
> argument, pg_dump interprets it as a connection string if it contains =.

Fixed this by passing the database name to pg_dump as a connection 
string. That way pg_dump doesn't interpret the database name. So now 
pg_dumpall calls pg_dump like this:

pg_dump ... "dbname='foo'"

instead of just

pg_dump ... "foo"

> 2. When you pass an invalid connection string to pg_dump, it passes a
> NULL pointer to printf when constructing the error message. It shows as
> "(null)" above, but would segfault on other platforms.

Fixed by printing an empty string instead of passing NULL to fprintf.

- Heikki


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



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


end of thread, other threads:[~2013-02-20 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-02-20 14:19 pg_dumpall fails if a database name contains = Heikki Linnakangas <hlinnakangas@vmware.com>
2013-02-20 15:17 ` Heikki Linnakangas <hlinnakangas@vmware.com>

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