Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s9EY1-000hgv-8R for pgsql-admin@arkaria.postgresql.org; Tue, 21 May 2024 01:44:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s9EY0-006cRn-9B for pgsql-admin@arkaria.postgresql.org; Tue, 21 May 2024 01:44:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s9EXz-006cRe-2g for pgsql-admin@lists.postgresql.org; Tue, 21 May 2024 01:44:11 +0000 Received: from mout-u-107.mailbox.org ([80.241.59.207]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s9EXv-001Hhx-SB for pgsql-admin@lists.postgresql.org; Tue, 21 May 2024 01:44:10 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4Vjy0548ypz9sq6; Tue, 21 May 2024 03:44:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ewie.name; s=MBO0001; t=1716255845; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WbLSyZ8AfDY/sYc4rXPn331delfWg6qx6Vj0+LX7TV8=; b=1RVJItkFI3eTygkHRmPsY00d/5phxQp50s0oLH4jRIP0i9u1/3U7dX3BNoB0EhgOuTsmZp pAsKBA0nIpVYdHWbY86M7Mx7YjBoooEdBdqhIe/jWHTl3t6p00zg1fm2Sutq7N70GLRgjF rsIlZw1tyffyUJY5H/OH+IOxkqzWyemB1mV7oVf8wNAizut4OzV5NpAzBoMAK1YUoO+X+F Fjq09FZCo7DV8zc+YvySBto2pDbBygBatW5OWjpd5xs+/k4SDJVDepGjAJurkYxu2gvdb0 tOZXeFumzosOgbSigerlGjyVFCMZVIa8GAMeSkCCN7pvLgJxWaKA6wRqhpitMA== Date: Tue, 21 May 2024 03:44:02 +0200 From: Erik Wienhold To: "David G. Johnston" Cc: Ron Johnson , Pgsql-admin Subject: Re: Comments in .pgpass file... Message-ID: References: <45ce11f5-52bc-47d7-bb95-e1ba5725b72b@ewie.name> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-05-21 03:24 +0200, David G. Johnston wrote: > On Monday, May 20, 2024, Erik Wienhold 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