Re: Comments in .pgpass file...

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Comments in .pgpass file...
Date: 2024-05-21 02:10:45
Message-ID: CANzqJaAZoD1UJa0qva5hpqSdwrYFvSTqOZthAH-2Aetvh0u3jQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Mon, May 20, 2024 at 9:10 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Ron Johnson <ronljohnsonjr(at)gmail(dot)com> writes:
> > It seems that psql (or maybe libpq) doesn't like trailing comments.
>
> Why would you think it would take that? The manual says that lines
> beginning with '#' are comments, but not more than that.
>

https://www.postgresql.org/docs/current/libpq-pgpass.html

I searched the man page for "#" and "comment". The only mention is in this
sentence:

[quote]

*hostname*:*port*:*database*:*username*:*password*

(You can add a reminder comment to the file by copying the line above and
preceding it with #.)
[/quote]

That one sentence can easily be read as only referring to the
"hostname:port..." line.

Since postgresql.conf and pg_hba.conf (I don't use pg_ident.conf) allow
trailing comments, it seems reasonable that .pgpass should too, for
consistency.

It also seems reasonable that hostnames in .pgpass should be
case-insensitive, since they're case-insensitive everywhere else in the
network world.

> But this does not:
> > 10.143.170.206:5432:*:11026270:Blarge # Host name: fubar
>
> If that acted as a comment, it'd be impossible to use passwords
> containing '#'.
>

Escapes. It escapes ":" and "\", so should be able to escape "#".

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message David G. Johnston 2024-05-21 03:04:13 Re: Comments in .pgpass file...
Previous Message Erik Wienhold 2024-05-21 01:44:02 Re: Comments in .pgpass file...