On Wed, Dec 23, 2020 at 6:35 PM Eric Hanson <eric@aquameta.com> wrote:
>
> I'm trying to store connection to postgres_fdw in the database I want to be able to store the full breadth of
connectionstyles and all the different types of connections that libpq supports. But having some troubles.
>
> Postgres_fdw wants options passed into CREATE SERVER, all broken out into separate variables, but this format is
neithera connection URI, nor a keyword/value string. One could imagine writing some parser that extracts all the
variablesand honors collisions in the same way libpq does (like when both the path and the query string specify a
port),but I really don't want to recreate that.
>
> It would be really nice if I could tap into libpq's connection string parser from SQL and use it to extract all the
variablesin a given connection string, so that I can then pipe those into CREATE SERVER options. Either that, or teach
postgres_fdwhow to consume standard connection strings.
>
> Suggestions? Is this worthy of a feature request?
>
https://www.postgresql.org/docs/13/libpq-connect.html#LIBPQ-PARAMKEYWORDS
lists the parameters that postgres_fdw accepts. "dbname" can be more
than just dbname. See
https://www.postgresql.org/docs/13/libpq-connect.html#LIBPQ-CONNSTRING.
And "dbname" is not in the list of exception paramters in section
"F.33.1.1. Connection Options" at
https://www.postgresql.org/docs/13/postgres-fdw.html#id-1.11.7.42.11.
I haven't tried this myself. But this might help you.
--
Best Wishes,
Ashutosh Bapat