Обсуждение: [HACKERS] HISTIGNORE for psql
Hello, 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)? Regards, vmk -- ************************************************************************ Tietotekniikkakeskus / Helsingin yliopisto IT department / University of Helsinki ************************************************************************
2017-08-17 9:23 GMT+02:00 Vesa-Matti J Kari <vmkari@cc.helsinki.fi>:
Hello,
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.
Regards
Pavel
Regards,
vmk
--
************************************************************ ************
Tietotekniikkakeskus / Helsingin yliopisto
IT department / University of Helsinki
************************************************************ ************
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Hello, On Thu, 17 Aug 2017, Pavel Stehule wrote: > 2017-08-17 9:23 GMT+02:00 Vesa-Matti J Kari <vmkari@cc.helsinki.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 ************************************************************************ -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Вложения
Hello, On Fri, 18 Aug 2017, Vesa-Matti J Kari wrote: > 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. Sorry, I guess I have written too many Python scripts. I no longer remember to free() memory in C, at least tokbuf should be free():d before returning in parse_histignore(). Regards, vmk -- ************************************************************************ Tietotekniikkakeskus / Helsingin yliopisto IT department / University of Helsinki ************************************************************************