Re: Notes on implementing URI syntax for libpq

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alexander Shulgin <ash(at)commandprompt(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Notes on implementing URI syntax for libpq
Date: 2011-11-24 13:59:08
Message-ID: CA+Tgmoa7cZJJgCVwJYv8WxR8TTK-HAty5LP3XvbwAQ1dmHJ88A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 24, 2011 at 8:50 AM, Alexander Shulgin
<ash(at)commandprompt(dot)com> wrote:
> What JDBC supports is rather weird and far from being ideal: http://jdbc.postgresql.org/documentation/head/connect.html
>
> The problem with supporting multiple syntaxes, IMO is that it makes libpq compatible in only one direction: from particular foreign syntax to libpq, but not from libqp to any other particular foreign syntax.  So when you see psql -d <URL> you wouldn't know if you can copy that URL to JDBC or any other connection interface parameter, unless you check the docs thoroughly.

Well, based on that document, I think that trying to be bug-compatible
with the JDBC syntax is a, erm, doomed effort. I mean, what are you
going to do with things like loglevel or logUnclosedConnections that
change the behavior of JDBC, not PostgreSQL?

I think we could do something like:

postgresql://user:pw(at)host:port/database?param1=val1&param2=val2&param3=val3&...

...where the param and val bits are standard libpq connection
parameters. And for compatibility you could allow "user" and
"password" to be specified as connection parameters rather than
included in the host portion of the string. But you're still not
going to be 100% compatible with JDBC, because we're not going support
unknownLenghth=42 in libpq just because JDBC has chosen to implement
some weirdness in that area.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2011-11-24 13:59:23 Re: bug of recovery?
Previous Message Andrew Dunstan 2011-11-24 13:57:36 Re: Making TEXT NUL-transparent