From: | Felipe Gasper <felipe(at)felipegasper(dot)com> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | David Gould <daveg(at)sonic(dot)net>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: pg_restore WAS Re: BUG #13702: pg_dump interprets “=” in a db name incorrectly |
Date: | 2015-10-23 19:42:32 |
Message-ID: | 562A8DA8.3090309@felipegasper.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 23 Oct 2015 2:14 PM, David G. Johnston wrote:
> On Fri, Oct 23, 2015 at 2:54 PM, Felipe Gasper <felipe(at)felipegasper(dot)com
> <mailto:felipe(at)felipegasper(dot)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(at)felipegasper(dot)com <mailto:felipe(at)felipegasper(dot)com>
> <mailto:felipe(at)felipegasper(dot)com
> <mailto:felipe(at)felipegasper(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | cstdenis | 2015-10-23 20:35:03 | BUG #13711: Error creating index on ltree column |
Previous Message | David G. Johnston | 2015-10-23 19:14:35 | Re: pg_restore WAS Re: [BUGS] BUG #13702: pg_dump interprets “=” in a db name incorrectly |