Re: Notes on implementing URI syntax for libpq

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Notes on implementing URI syntax for libpq
Дата
Msg-id 1322140039-sup-48@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: Notes on implementing URI syntax for libpq  (Alexander Shulgin <ash@commandprompt.com>)
Ответы Re: Notes on implementing URI syntax for libpq  (Alexander Shulgin <ash@commandprompt.com>)
Re: Notes on implementing URI syntax for libpq  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: Notes on implementing URI syntax for libpq  (Florian Weimer <fweimer@bfk.de>)
Re: Notes on implementing URI syntax for libpq  (Greg Smith <greg@2ndQuadrant.com>)
Список pgsql-hackers
Excerpts from Alexander Shulgin's message of jue nov 24 05:58:57 -0300 2011:

> Excerpts from Martijn van Oosterhout's message of Thu Nov 24 09:40:42 +0200 2011:

> > Which does raise the valid question of how to represent that in URI
> > syntax. SQLAlchemy (for example) doesn't try with it's URL syntax, to
> > connect to a non-default UNIX socket, you need to create the URL object
> > directly.
>
> Well, whatever syntax we're going to invent here: it is not supported by the JDBC driver.
>
>  "Because Java does not support using unix sockets the PostgreSQL™ server must be configured to allow TCP/IP
connections."
>
>   http://jdbc.postgresql.org/documentation/head/prepare.html
>
> Or, this has to be done not in the URI syntax itself, but with the use of some external option.
>
> Or maybe we can just add &unixsocket=... and hope that JDBC simply ignores that?

I think this is misguided.  We don't need to have a URL that specifies a
Unix socket to work on JDBC, because it's obviously not going to work;
if you just have it "ignore" the &unixsocket bit, then the URI is no
longer the same and you could have it connecting to a completely
different server.

I think we should just propose something that will not work in JDBC.
Surely if the user wants an URL that works both in JDBC and libpq, they
should just not use a Unix-domain-socket specifying URI in the first
place.

What about something like
postgresql://<path-to-dir>:port/database

where the < > are present, i.e. if you want to specify a different
socket directory,

postgresql://</var/run/postgresql>:5433/database

and if you just want to use the default location,

postgresql://<>:5433/database


A coworker also suggested using a different designator:

postgresqli:///path/to/socket:5433/database
postgresqli://:5433/database


> > How about the "service" option, that's a nice way of handling
> > non-default socket options.
>
> The service handling isn't going to be affected with the proposed approach.  So, if PGSERVICE is given, the options
fromthe service file are applied after the URI is parsed, filling any parameters not set using previous methods. 

I think the question is allowing the URI to specify a service.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: pg_upgrade relation OID mismatches
Следующее
От: Robert Haas
Дата:
Сообщение: Re: xpath_table