Re: Feature proposal, DBURL: psql pgsql://joe:p4zzw0rd@example.org:2345/dbname

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, 'Hans Schou *EXTERN*' <hans(dot)schou(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Feature proposal, DBURL: psql pgsql://joe:p4zzw0rd@example.org:2345/dbname
Date: 2017-07-05 13:41:09
Message-ID: 0c95a5bd-57cd-f566-f858-478853f2422e@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/05/2017 06:15 AM, Albe Laurenz wrote:
> Hans Schou wrote:
>> The dburl (or dburi) has become common to use by many systems connecting to a database.
>> The feature is that one can pass all parameters in a string, which has similar pattern as
>> http-URI do.
>>
>> Especially when using psql in a script, having the credentials in one string is
>> convenient.
>>
>>
>> The syntax could be:
>>
>> [scheme[<+>dsn]]://[[username[:[password]](at)][host][:port][/[dbname][/[[table[/[column[,col
>> umn...]*]]]|sql]]]
>>
>>
>> Example of usage:
>> psql pgsql://joe:p4zzw0rd(at)example(dot)org:2345/dbname
>
> [...]
>
>> I have attached an example of how it could be implemented. It uses libpcre RegEx to pass
>> the dburl.
>
> Unless I misunderstand, this has been in PostgreSQL since 9.2:

T think the OP was referring to the latter part of:

[scheme[<+>dsn]]://[[username[:[password]](at)][host][:port][/[dbname][/[[table[/[column[,column...]*]]]|sql]]]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The thing is that in a quick search on this I did not find a reference
implementation of this to compare against.

> Yours,
> Laurenz Albe
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2017-07-05 13:47:27 Re: pg_start/stop_backup non-exclusive scripts to snapshot
Previous Message Tom van Tilburg 2017-07-05 13:21:48 building extension with large string inserts