Re: HISTIGNORE for psql

From: Vesa-Matti J Kari <vmkari(at)cc(dot)helsinki(dot)fi>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: HISTIGNORE for psql
Date: 2017-08-18 19:15:28
Message-ID: alpine.LRH.2.20.1708182150100.2836@cedi.it.helsinki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello,

On Thu, 17 Aug 2017, Pavel Stehule wrote:

> 2017-08-17 9:23 GMT+02:00 Vesa-Matti J Kari <vmkari(at)cc(dot)helsinki(dot)fi>:
>
> Bash has HISTIGNORE feature that allows you to exclude certain commands
> from the command history (e.g. shutdown, reboot, rm *).
>
> Would it make any sense to add such a feature to psql (e.g. to ignore
> DROP, DELETE commands)?
>
>
> It is not bad idea.

A quick patch is attached. Not sure about the quality, hacked this
together in about four hours, trying to figure out how to do it correctly
the PostgreSQL way.

Based on a few tests, the patch seems to work.

I do not know how the Bash implementation works, but I chose to disallow
forms such as:

:
:a
a:
a::b

So specifying empty strings seems like a syntax error to me. But I do
not know how to report failures for those, the current patch disallows
them and HISTIGNORE simply does not work with invalid syntax.

Regards,
vmk
--
************************************************************************
Tietotekniikkakeskus / Helsingin yliopisto
IT department / University of Helsinki
************************************************************************

Attachment Content-Type Size
histignore-feature.patch text/plain 4.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2017-08-18 19:36:16 Re: Crash report for some ICU-52 (debian8) COLLATE and work_mem values
Previous Message Robert Haas 2017-08-18 19:00:20 Re: Update low-level backup documentation to match actual behavior