From: Felipe Gasper <felipe@felipegasper.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: David Gould <daveg@sonic.net>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: pg_restore WAS Re: BUG #13702: pg_dump interprets “=” in a db name incorrectly
Date: Fri, 23 Oct 2015 14:42:32 -0500
Message-ID: <562A8DA8.3090309@felipegasper.com> (raw)
In-Reply-To: <CAKFQuwavhkv3pjGx_H1g601siVMtZibt=mdAu+JQyPWmCXGbAQ@mail.gmail.com>
References: <20151023003445.931.91267@wrigleys.postgresql.org>
<CAKFQuwZPfVGx9URCy6bOJLiC+h4s6d7EpwkdGS1NCcsvfyyGZA@mail.gmail.com>
<56298DAC.3070906@felipegasper.com>
<20151023054510.5b5467c6@engels>
<562A7A76.9000700@felipegasper.com>
<CAKFQuwbS+mUpCcBg2BmS=sv=1UDt=L63JYkhR9qxJ-3qYN_kvg@mail.gmail.com>
<562A8271.400@felipegasper.com>
<CAKFQuwavhkv3pjGx_H1g601siVMtZibt=mdAu+JQyPWmCXGbAQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On 23 Oct 2015 2:14 PM, David G. Johnston wrote:
> On Fri, Oct 23, 2015 at 2:54 PM, Felipe Gasper <felipe@felipegasper.com
> <mailto:felipe@felipegasper.com>>wrote:
>
> On 23 Oct 2015 1:33 PM, David G. Johnston wrote:
>
> On Fri, Oct 23, 2015 at 2:20 PM, Felipe Gasper
> <felipe@felipegasper.com <mailto:felipe@felipegasper.com>
> <mailto:felipe@felipegasper.com
> <mailto:felipe@felipegasper.com>>>wrote:
>
>
>
> Again, the "--dbname" argument can either be an actual database
> name or
> a "connection info" object.
>
>
> But the documentation doesn’t say that; it only says that it’s the
> name of the database. Should the documentation be updated, then?
>
> In the later case the "=" has a special
> meaning. If your database has an "=" in its name then it seems
> like you
> have to use the "connection info" definition form. Note I
> haven't dug
> into this with respect to pg_restore but that is the findings
> from the
> brief psql test I performed.
>
>
> Is “connection info” an option with pg_restore, though, which
> mandates a --dbname argument?
>
>
>
> http://www.postgresql.org/docs/9.4/interactive/libpq-connect.html#LIBPQ-CONNECT-DBNAME
>
> dbname
> The database name. Defaults to be the same as the user name. In certain
> contexts, the value is checked for extended formats; see Section 31.1.1
> for more details on those.
>
> 31.1.1
> http://www.postgresql.org/docs/9.4/interactive/libpq-connect.html#LIBPQ-CONNSTRING
>
> See "dbname" in particular
>
> So it is documented. Suggestions and patches welcomed if you think it
> should be covered differently.
Ah, ok.
The reason why I didn’t find this myself was that there’s nothing that
leads me from the pg_restore docs’ description of the --dbname parameter
to the sections you’ve mentioned above.
Maybe that’s the thing, then--would it work to add a link to describe
how pg_restore parses the argument to “--dbname”? A usage example, too,
perhaps, to show how any valid DB name that the PostgreSQL server
recognizes can be fed into pg_restore, pg_dump, etc.?
>
> pg_restore --dbname="dbname=crazy=db=name" [...] likely will work but I
> cannot quickly test it ATM.
>
Hooray! At least in 9.0.18, if I quote the DB name as conninfo string, I
can indeed restore to a DB with spaces, equals, etc. in its name.
Now to try it in 8.1. If it doesn’t work there, we’ll probably just
forbid “=” in DB names and call it a day.
Thank you for your responses. I hope I’ve not been untoward in any of this
-FG
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: felipe@felipegasper.com, david.g.johnston@gmail.com, daveg@sonic.net
Subject: Re: pg_restore WAS Re: BUG #13702: pg_dump interprets “=” in a db name incorrectly
In-Reply-To: <562A8DA8.3090309@felipegasper.com>
References: <20151023003445.931.91267@wrigleys.postgresql.org> <CAKFQuwZPfVGx9URCy6bOJLiC+h4s6d7EpwkdGS1NCcsvfyyGZA@mail.gmail.com> <56298DAC.3070906@felipegasper.com> <20151023054510.5b5467c6@engels> <562A7A76.9000700@felipegasper.com> <CAKFQuwbS+mUpCcBg2BmS=sv=1UDt=L63JYkhR9qxJ-3qYN_kvg@mail.gmail.com> <562A8271.400@felipegasper.com> <CAKFQuwavhkv3pjGx_H1g601siVMtZibt=mdAu+JQyPWmCXGbAQ@mail.gmail.com> <562A8DA8.3090309@felipegasper.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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