I am running several commands, some repeatedly, from the postgresql command line tool. In Bash, the history function keeps one command for each set of sequential identical commands, it seems that postgresql command line does not do that by default. So for example if I run command 'a' once, then command 'b' 100 times, I have to scroll up 100 times before running command 'a' again. This is a user-unfriendly way of going about things. Is there an option to have alternate, bash-like functionality from the postgresql command line, in which only unique commands are remembered in the history?
Postgresql unique history
postgresql
Related Question
- PostgreSQL 9.2 – Resolving Different Settings Reported in pgsql
- PostgreSQL – Equivalent of mysqld –bootstrap or mysqld –init-file
- PostgreSQL – Fix PostgreSQL Not Running on Mac
- PostgreSQL – How to Enable Implicit Casts in PostgreSQL >=9.2
- Postgresql – Many-to-One replication / Transactional Replication
- PostgreSQL – Write Ahead Logs Archive Mode
- PostgreSQL/pgAdminIII – Send Command Line Commands via UI
- Postgresql – set -x equivalent for the Postgres cli/console/prompt/repl
Best Answer
psql
has a variable calledHISTCONTROL
. Quoting the manual:I have this configured to automatically take effect on
psql
startup by adding the lineto my
.psqlrc
.