Skip site navigation (1) Skip section navigation (2)

pgsql: Accept postgres:// URIs in libpq connection functions

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Accept postgres:// URIs in libpq connection functions
Date: 2012-04-11 07:36:12
Message-ID: E1SHs68-0007jh-8i@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
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](at)][unix-socket][:port[/dbname]][?param1=value1&...]
 postgres://[user[:pwd](at)][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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/b035cb9db7aa7c0f28581b23feb10d3c559701f6

Modified Files
--------------
doc/src/sgml/libpq.sgml                 | 1164 +++++++++++++++++--------------
doc/src/sgml/ref/psql-ref.sgml          |   11 +-
src/interfaces/libpq/Makefile           |    5 +
src/interfaces/libpq/fe-connect.c       |  793 +++++++++++++++++++--
src/interfaces/libpq/test/Makefile      |   22 +
src/interfaces/libpq/test/README        |    7 +
src/interfaces/libpq/test/expected.out  |  163 +++++
src/interfaces/libpq/test/regress.in    |   49 ++
src/interfaces/libpq/test/regress.sh    |   21 +
src/interfaces/libpq/test/uri-regress.c |   84 +++
10 files changed, 1714 insertions(+), 605 deletions(-)

pgsql-committers by date

Next:From: Tom LaneDate: 2012-04-11 16:03:28
Subject: pgsql: Ignore missing schemas during non-interactive assignment ofsear
Previous:From: Bruce MomjianDate: 2012-04-11 02:09:37
Subject: Re: pgsql: Make pg_tablespace_location(0) return the database's default tab

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group