Re: Another review of URI for libpq, v7 submission

From: Alex <ash(at)commandprompt(dot)com>
To: Marko Kreen <markokr(at)gmail(dot)com>
Cc: Daniel Farina <daniel(at)heroku(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Another review of URI for libpq, v7 submission
Date: 2012-03-22 21:42:24
Message-ID: 87k42cb9dr.fsf@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alex <ash(at)commandprompt(dot)com> writes:

> Marko Kreen <markokr(at)gmail(dot)com> writes:
>
>> On Thu, Mar 15, 2012 at 11:29:31PM +0200, Alex wrote:
>>> https://github.com/a1exsh/postgres/commits/uri
>>
>> The point of the patch is to have one string with all connection options,
>> in standard format, yes? So why does not this work:
>>
>> db = PQconnectdb("postgres://localhost");
>>
>> ?
>
> Good catch.
>
> I've figured out that we'll need a bit more intrusive change than simply
> overriding the expand_dbname check in conninfo_array_parse (like the
> current version does) to support URIs in all PQconnect* variants.

Okay, at last here's v9, rebased against current master branch.

What's new in this version is parse_connection_string function to be
called instead of conninfo_parse. It will check for possible URI in the
connection string and dispatch to conninfo_uri_parse if URI was found,
otherwise it will fall back to conninfo_parse.

In two places in code we don't want to parse the string unless it is
deemed a real connection string and not plain dbname. The new function
recognized_connection_string is added to check this.

Thanks Marko for spotting the problem and thanks Tom for committing the
refactoring patch!

--
Alex

Attachment Content-Type Size
libpq-uri-v9.patch application/octet-stream 31.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2012-03-22 21:44:24 Re: Finer Extension dependencies
Previous Message Alvaro Herrera 2012-03-22 19:46:38 Re: Finer Extension dependencies