Re: SQL/MED compatible connection manager

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: SQL/MED compatible connection manager
Дата
Msg-id 200812291519.59167.peter_e@gmx.net
обсуждение исходный текст
Ответ на Re: SQL/MED compatible connection manager  (Martin Pihlak <martin.pihlak@gmail.com>)
Ответы Re: SQL/MED compatible connection manager  (Martin Pihlak <martin.pihlak@gmail.com>)
Список pgsql-hackers
On Wednesday 17 December 2008 17:17:26 Martin Pihlak wrote:
> It'd make more sense if we changed the name to pg_get_datasource ;)
>
> We could make the pg_get_remote_connection_info Postgres specific -- in
> this case it would be changed to return just the connect string text. NULL
> for the other wrappers -- for these use the pg_get*options to construct
> the connect strings. Comments?

Well, what this function essentially does is a text transformation of the 
options, something like this:

peter=# SELECT array_to_string(fdwoptions || srvoptions || umoptions, ' ') 
FROM pg_foreign_data_wrapper fdw, pg_foreign_server srv, pg_user_mappings um 
WHERE fdw.oid = srv.srvfdw AND srv.oid = um.srvid;                  array_to_string
-----------------------------------------------------host=localhost port=5432 user=peter password=seKret
(1 row)

(You can enhance this with quoting etc., but that's the essence.)

So, we could add a function whose job it is to convert all options to a 
PostgreSQL connection string.  I wouldn't worry about dealing with other 
wrappers specifically.  They could still use the function, but the result 
would not make much sense.

I would call it something like

pg_postgresql_fdw_options_string(server, user) returns text

Not sure if a C implementation based on your old function or an SQL 
implementation is better.


В списке pgsql-hackers по дате отправления:

Предыдущее
От: KaiGai Kohei
Дата:
Сообщение: Updates of SE-PostgreSQL 8.4devel patches (r1368)
Следующее
От: "Dawid Kuroczko"
Дата:
Сообщение: Idea - fallback mode for psql backslash commands using information_schema