public inbox for [email protected]  
help / color / mirror / Atom feed
From: Vik Fearing <[email protected]>
To: Tom Lane <[email protected]>
To: Kevin Wang <[email protected]>
Cc: [email protected]
Subject: Re: A tiny improvement of psql
Date: Tue, 26 Dec 2023 22:45:31 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CAAZWVYpquc=nHUAnmSS62SYS0wQe8SNNr_X6H-=ba9i5BWJOjA@mail.gmail.com>
	<[email protected]>

On 12/26/23 17:36, Tom Lane wrote:
> Kevin Wang <[email protected]> writes:
>> As you know, we can use the UP arrow key to get the previous command to
>> avoid extra typing. This is a wonderful feature to save the lives of every
>> DBA. However, if I type the commands like this sequence: A, B, B, B, B, B,
>> B,  as you can see, B is the last command I execute.
> 
>> But if I try to get command A, I have to press the UP key 7 times.  I think
>> the best way is: when you press the UP key, plsql should show the command
>> that is different from the previous command, so the recall sequence should
>> be B -> A, not B -> B -> ... -> A.  Then I only press the UP key 2 times to
>> get command A.
> 
> This is driven by libreadline, not anything we control.  I have
> seen the behavior you describe in some other programs, so I wonder
> whether it's configurable.

It is kind of something we control.  Per the psql docs, setting

     HISTCONTROL=ignoredups

will do the trick.

https://www.postgresql.org/docs/current/app-psql.html#APP-PSQL-VARIABLES-HISTCONTROL
-- 
Vik Fearing







view thread (4+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: A tiny improvement of psql
  In-Reply-To: <[email protected]>

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

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