WIP: URI connection string support for libpq

Поиск
Список
Период
Сортировка
От Alexander Shulgin
Тема WIP: URI connection string support for libpq
Дата
Msg-id 1323723673-sup-8978@moon
обсуждение исходный текст
Ответы Re: WIP: URI connection string support for libpq  (Peter van Hardenberg <pvh@pvh.ca>)
Список pgsql-hackers
Hello Hackers,

Attached is a work-in-progress patch for URI connection string syntax support in libpq.  The recent discussion (also
pointingto the original one) is here:  

  http://archives.postgresql.org/message-id/1321899990-sup-1235@moon

The patch adds support for the following syntax in psql, by adding special handling of dbname parameter, when it starts
with"postgresql://", e.g: 

  psql -d postgresql://user@pw:host:port/dbname?param1=value1¶m2=value2...

Virtually every component of the above syntax is optional, ultimately allowing for, e.g:

  psql -d postgresql:///

to specify local connection via Unix socket, with default port, user name, dbname, etc.

URI percent-encoding is handled, in particular, allowing to include special symbols in the embedded password string, or
tospecify non-standard Unix socket location, like the following: 

  psql -d postgresql://%2Fvar%2Fpgsql%2Ftmp/mydb

The patch applies cleanly against the master branch and compiles w/o errors or warnings.  No tests were broken by this
patchon my box, as far as I can tell. 

The patch follows design initially proposed and tries to address feedback gathered from the recent discussion.  Special
provisionwas made to improve compatibility with JDBC's connection URIs, by treating "ssl=true" parameter as equivalent
of"sslmode=require". 

The patch intentionally omits documentation changes, to focus on the desired behavior and new code design.

I've put reasonable effort into testing the new code by feeding various parameters to "psql -d".  However, if there's a
facilityfor writing formal regression tests against psql, I'd be happy to use that. 

I'm also adding this to the next open CommitFest: 2012-01.

--
Regards,
Alex

Вложения

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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: includeifexists in configuration file
Следующее
От: Greg Smith
Дата:
Сообщение: Re: [REVIEW] pg_last_xact_insert_timestamp