Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rIAYS-006ioO-5m for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Dec 2023 16:45:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rIAYQ-00EOI8-6d for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Dec 2023 16:45:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rIAQB-00DsBZ-H7 for pgsql-hackers@lists.postgresql.org; Tue, 26 Dec 2023 16:36:47 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rIAQ8-00E0CN-Fl for pgsql-hackers@postgresql.org; Tue, 26 Dec 2023 16:36:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3BQGafeF2036814; Tue, 26 Dec 2023 11:36:41 -0500 From: Tom Lane To: Kevin Wang cc: pgsql-hackers@postgresql.org Subject: Re: A tiny improvement of psql In-reply-to: References: Comments: In-reply-to Kevin Wang message dated "Sun, 24 Dec 2023 13:17:38 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2036812.1703608601.1@sss.pgh.pa.us> Date: Tue, 26 Dec 2023 11:36:41 -0500 Message-ID: <2036813.1703608601@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Kevin Wang 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. > Another requirement is: could we use / to repeat executing the last command > in plsql just like sqlplus in Oracle? I'm pretty certain you can configure this for yourself with readline. regards, tom lane