Re: Correct handling of blank/commented lines in PSQL interactive-mode history - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: Correct handling of blank/commented lines in PSQL interactive-mode history
Date
Msg-id 20210906193731.GH26465@telsasoft.com
Whole thread Raw
In response to Re: Correct handling of blank/commented lines in PSQL interactive-mode history  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-hackers
On Mon, Sep 06, 2021 at 07:50:15AM -0700, David G. Johnston wrote:
> On Mon, Sep 6, 2021 at 7:13 AM Greg Nancarrow <gregn4422@gmail.com> wrote:
> > I've attached a patch that corrects the behaviour.
> > For the type of lines mentioned, the patch makes the history behave
> > more like Bash history.

The behavior of bash is configurable here:

|HISTCONTROL
|      A  colon-separated  list  of  values controlling how commands are saved on the history list.  If the list of
valuesincludes ignorespace, lines which begin with a space character are not saved in the history
 
|      list....

> I have my doubts that you've really fixed anything here since Bash is a
> line-oriented shell while psql is a statement-oriented one.  This is a
> feature.

Hm, I don't think bash is "line oriented" ?  You can type anything into it that
you'd put in a shell script.  For example:

$ for a in `seq 1 3`
> do
> echo $a
> done
1
2
3

-- 
Justin



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: ExecRTCheckPerms() and many prunable partitions
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert