Re: A tiny improvement of psql

From: Vik Fearing <vik(at)postgresfriends(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kevin Wang <kevinpgcloud(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: A tiny improvement of psql
Date: 2023-12-26 21:45:31
Message-ID: cac32bd7-f620-465d-8e1a-0300cfb2c321@postgresfriends.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/26/23 17:36, Tom Lane wrote:
> Kevin Wang <kevinpgcloud(at)gmail(dot)com> 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2023-12-26 21:52:06 Re: Add the ability to limit the amount of memory that can be allocated to backends.
Previous Message Peter Eisentraut 2023-12-26 21:03:20 Re: pg_stat_statements: more test coverage