pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Wienhold <ewie@ewie.name>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Ron Johnson <ronljohnsonjr@gmail.com>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: Comments in .pgpass file...
Date: Tue, 21 May 2024 03:44:02 +0200
Message-ID: <de5e88f7-6baf-4f2f-906d-2a5146a0a085@ewie.name> (raw)
In-Reply-To: <CAKFQuwY=5_rReQ9dW7gh_ivuSGKg6F4G=O6y1ruCg4zB0svKjA@mail.gmail.com>
References: <CANzqJaBQ+t4JmLCQspU1Tyi=+oQsdcL_q4e3r93n976vC2f=vQ@mail.gmail.com>
	<45ce11f5-52bc-47d7-bb95-e1ba5725b72b@ewie.name>
	<CAKFQuwY=5_rReQ9dW7gh_ivuSGKg6F4G=O6y1ruCg4zB0svKjA@mail.gmail.com>

On 2024-05-21 03:24 +0200, David G. Johnston wrote:
> On Monday, May 20, 2024, Erik Wienhold <ewie@ewie.name> wrote:
> 
> > On 2024-05-21 03:01 +0200, Ron Johnson wrote:
> > > It seems that psql (or maybe libpq) doesn't like trailing comments.
> > >
> > > This works:
> > > 10.143.170.206:5432:*:11026270:Blarge
> > >
> > > But this does not:
> > > 10.143.170.206:5432:*:11026270:Blarge # Host name: fubar
> >
> > How should libpq know where the password ends and the comment begins
> > while still accepting passwords that contain "#"?  The password is
> > everything between the 4th unescaped colon and the end of line.
> >
> > This could be made explicit in the docs.  But the docs don't even say
> > that you can put entries and comments one the same line.
> >
> 
> As written the docs say if your password contain : or \ you should escape
> that character with a \ …

Oh, I misread the code, now that you mention it.  libpq reads the
password up to the first unescaped colon.  So one could write:

    10.143.170.206:5432:*:11026270:Blarge: # Host name: fubar

Note the colon right after "Blarge".  But that will very likely clash
with fields that may be added in the future.

-- 
Erik





view thread (9+ messages)  latest in thread

Message-ID: <de5e88f7-6baf-4f2f-906d-2a5146a0a085@ewie.name>
Permalink:  ../de5e88f7-6baf-4f2f-906d-2a5146a0a085@ewie.name/
Also on:    postgresql.org/message-id/de5e88f7-6baf-4f2f-906d-2a5146a0a085@ewie.name

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: ewie@ewie.name, david.g.johnston@gmail.com, ronljohnsonjr@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Comments in .pgpass file...
  In-Reply-To: <de5e88f7-6baf-4f2f-906d-2a5146a0a085@ewie.name>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox