Re: PostgreSQL URI

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Paul Förster <paul(dot)foerster(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: PostgreSQL URI
Date: 2021-02-26 14:30:50
Message-ID: 20210226143050.GA875@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2021-Feb-25, Paul Förster wrote:

> So, my suggestion is:
>
> postgresql://[user[:password](at)][[host][:port]][,...][/dbname][?param1=value1&...]
>
> Still, I think that it's an improvement, because it makes clear that not only the port, but also the host may be repeated.

I wonder if we shouldn't instead try to break it up in parts that can be
explained or described separately. This many brackets makes it pretty
hard to read.

We could say something like

postgresql://[userspec(at)][hostspec][/dbname][?paramspec]

where
userspec is user[:password]
hostspec is [[host][:port]][,...]
paramspec is param1=value1&...

which makes it easier to focus on each part separately, and we can
provide more verbose explanations or examples where needed. (Now that I
broke it up, the original line became very clear to me, but when I saw
it in isolation it was not. You need to count brackets carefully to be
able to read it.)

--
Álvaro Herrera Valdivia, Chile

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Förster 2021-02-26 14:47:37 Re: PostgreSQL URI
Previous Message Laurenz Albe 2021-02-26 11:45:15 Re: Tables used by a function