Accept postgres:// URIs in libpq connection functions
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 11 Apr 2012 06:59:32 +0000 (03:59 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 11 Apr 2012 07:33:51 +0000 (04:33 -0300)
commitb035cb9db7aa7c0f28581b23feb10d3c559701f6
treeb4e8f6916a369fef1f3707a59d9798f2ce9fa155
parent3769fa5fc64298143cf535c8a06921793598e458
Accept postgres:// URIs in libpq connection functions

postgres:// URIs are an attempt to "stop the bleeding" in this general
area that has been said to occur due to external projects adopting their
own syntaxes.  The syntaxes supported by this patch:

 postgres://[user[:pwd]@][unix-socket][:port[/dbname]][?param1=value1&...]
 postgres://[user[:pwd]@][net-location][:port][/dbname][?param1=value1&...]

should be enough to cover most interesting cases without having to
resort to "param=value" pairs, but those are provided for the cases that
need them regardless.

libpq documentation has been shuffled around a bit, to avoid stuffing
all the format details into the PQconnectdbParams description, which was
already a bit overwhelming.  The list of keywords has moved to its own
subsection, and the details on the URI format live in another subsection.

This includes a simple test program, as requested in discussion, to
ensure that interesting corner cases continue to work appropriately in
the future.

Author: Alexander Shulgin
Some tweaking by Álvaro Herrera, Greg Smith, Daniel Farina, Peter Eisentraut
Reviewed by Robert Haas, Alexey Klyukin (offlist), Heikki Linnakangas,
Marko Kreen, and others

Oh, it also supports postgresql:// but that's probably just an accident.
doc/src/sgml/libpq.sgml
doc/src/sgml/ref/psql-ref.sgml
src/interfaces/libpq/Makefile
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/test/Makefile [new file with mode: 0644]
src/interfaces/libpq/test/README [new file with mode: 0644]
src/interfaces/libpq/test/expected.out [new file with mode: 0644]
src/interfaces/libpq/test/regress.in [new file with mode: 0644]
src/interfaces/libpq/test/regress.sh [new file with mode: 0644]
src/interfaces/libpq/test/uri-regress.c [new file with mode: 0644]