Document spaces in .pgpass need to be escaped

Started by James Colemanalmost 5 years ago3 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliessuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t44871
psql -h localhost -U postgres

Built from patchset v1 (message #1), September 20, 2026 at 06:02 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t44871_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t44871_1 && git checkout t44871_1

Patchset v1 (message #1) is on t44871_1

Jump to latest
#1James Coleman
jtc331@gmail.com

A coworker has a space in a Postgres password and noticed .pgpass
didn't work; escaping it fixed the issue. That requirement wasn't
documented (despite other escaping requirements being documented), so
I've attached a patch to add that comment.

Thanks,
James Coleman

Attachments:

t44871_1
v1-0001-Document-spaces-in-.pgpass-need-to-be-escaped.patchapplication/octet-stream; name=v1-0001-Document-spaces-in-.pgpass-need-to-be-escaped.patchDownload+3-3
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: James Coleman (#1)
Re: Document spaces in .pgpass need to be escaped

James Coleman <jtc331@gmail.com> writes:

A coworker has a space in a Postgres password and noticed .pgpass
didn't work; escaping it fixed the issue. That requirement wasn't
documented (despite other escaping requirements being documented), so
I've attached a patch to add that comment.

I looked at passwordFromFile() and I don't see any indication that
it treats spaces specially. Nor does a quick test here confirm
this report. So I'm pretty certain that this proposed doc change
is wrong. Perhaps there's some other issue to investigate, though?

regards, tom lane

#3James Coleman
jtc331@gmail.com
In reply to: Tom Lane (#2)
Re: Document spaces in .pgpass need to be escaped

On Wed, Sep 29, 2021 at 12:13 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

James Coleman <jtc331@gmail.com> writes:

A coworker has a space in a Postgres password and noticed .pgpass
didn't work; escaping it fixed the issue. That requirement wasn't
documented (despite other escaping requirements being documented), so
I've attached a patch to add that comment.

I looked at passwordFromFile() and I don't see any indication that
it treats spaces specially. Nor does a quick test here confirm
this report. So I'm pretty certain that this proposed doc change
is wrong. Perhaps there's some other issue to investigate, though?

regards, tom lane

Thanks for taking a look.

I'm honestly not sure what happened here. I couldn't reproduce again
either, and on another box with this coworker we could reproduce, but
then realized the pgpass entry was missing a field. I imagine it must
have been similar on the original box we observed the error on, but
both of our memories were of just adding teh escape characters...

I'll mark the CF entry as withdrawn.

Thanks,
James Coleman