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
Subject: authentication/t/ trashes ~/.psql_history
Date: 2023-12-21 18:21:36
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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

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.

My first idea was that should take responsibility for
preventing this, by explicitly setting $ENV{PSQL_HISTORY} to "/dev/null"
if the calling script hasn't set some other value. However, that could
fail if the user who runs the test habitually sets PSQL_HISTORY.

A messier but safer alternative would be to supply the -n switch by
default, with some way for to override that.


regards, tom lane


Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2023-12-21 18:38:27 Avoid computing ORDER BY junk columns unnecessarily
Previous Message Pavel Stehule 2023-12-21 17:43:22 Re: Functions to return random numbers in a given range