Re: authentication/t/ trashes ~/.psql_history

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Re: authentication/t/ trashes ~/.psql_history
Date: 2023-12-22 22:11:36
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I wrote:
> I happened to notice this stuff getting added to my .psql_history:
> \echo background_psql: ready
> SET password_encryption='scram-sha-256';
> ;
> \echo background_psql: QUERY_SEPARATOR
> SET scram_iterations=42;
> ;
> \echo background_psql: QUERY_SEPARATOR
> \password scram_role_iter
> \q

> After grepping for these strings, this is evidently the fault of
> src/test/authentication/t/ by way of,
> which fires up an interactive psql run that is not given the -n switch.

> Currently the only other user of interactive_psql() seems to be
> psql/t/, which avoids this problem by
> explicitly redirecting the history file. We could have
> do likewise, or we could have it pass the -n switch, but I think we're
> going to have this problem resurface repeatedly if we leave it to the
> outer test script to remember to do it.

After studying this some more, my conclusion is that
failed to borrow as much as it should have from
Specifically, we want all the environment-variable changes that that
script performed to be applied in any test using an interactive psql.
Maybe ~/.inputrc and so forth would never affect any other test scripts,
but that doesn't seem like a great bet.

So that leads me to the attached proposed patch.

regards, tom lane

Attachment Content-Type Size
v1-set-environment-safely-in-interactive_psql.patch text/x-diff 4.0 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Przemysław Sztoch 2023-12-22 22:25:51 Re: date_trunc function in interval version
Previous Message Alexander Korotkov 2023-12-22 22:04:12 Re: May be BUG. Periodic burst growth of the checkpoint_req counter on replica.