On Thu, Jul 27, 2017 at 12:21 AM, Tom Lane <t...@sss.pgh.pa.us> wrote: > Robert Haas <robertmh...@gmail.com> writes: >> On Wed, Jul 26, 2017 at 5:38 AM, Ashutosh Bapat >> <ashutosh.ba...@enterprisedb.com> wrote: >>> According to F.34.1.1 at [1] passing connection string as dbname >>> option should work, so your question is valid. I am not aware of any >>> discussion around this on hackers. > >> I kind of wonder if this had some security aspect to it? But not sure. > > The main problem to my mind is that a connection string could possibly > override items meant to be specified elsewhere. In particular it ought > not be allowed to specify the remote username or password, because those > are supposed to come from the user mapping object not the server object. > I suspect you could break things by trying to specify client_encoding > there, as well.
+1. > > In any case, I entirely reject the argument that the existing > documentation says this should work. It says that you can specify (most > of) the same fields that are allowed in a connection string, not that one > of those fields might be taken to *be* a connection string. > Section F.34.1.1. at [1] says "A foreign server using the postgres_fdw foreign data wrapper can have the same options that libpq accepts in connection strings, as described in Section 33.1.2, except that these options are not allowed:". When it says, " accepts same options", users would interpret it as "accept in the same manner as specified in the referenced section". Also, dbname is not one of the listed exceptions, so a user would expect same behaviour when the same value for dbname option is provided in foreign server options and libpq connection string. In the referenced section "dbname" is described as -- 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 33.1.1 for more details on those. -- There is some grey area where different people will interpret those sentences in different manner. So, may be better to say that "dbname" option in foreign server accepts only database names. [1] https://www.postgresql.org/docs/10/static/postgres-fdw.html#idm44880567492496 -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers