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

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'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:15:18
Message-ID: A737B7A37273E048B164557ADEF4A58B53A703AA@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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:

https://www.postgresql.org/docs/current/static/libpq-connect.html#AEN45571
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=b035cb9db7aa7c0f28581b23feb10d3c559701f6

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

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