Re: Correct handling of blank/commented lines in PSQL interactive-mode history

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Greg Nancarrow <gregn4422(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Correct handling of blank/commented lines in PSQL interactive-mode history
Date: 2021-09-06 19:37:31
Message-ID: 20210906193731.GH26465@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)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 values includes 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-09-06 19:47:37 Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert
Previous Message Alvaro Herrera 2021-09-06 19:35:20 Re: ExecRTCheckPerms() and many prunable partitions