Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disallow psql command history duplicates

How to disallow psql command history duplicates?

Is this possible to make psql command history delete all duplicate history commands upon enter of new commands?

like image 467
exebook Avatar asked Nov 22 '16 16:11

exebook


People also ask

Where is psql history stored?

psql_history file is in the home directory of the postgres user (e.g. /home/postgres/. psql_history ), not in the home directory of the user you originally logged in with.

How do I stop a postgres prompt?

Type \q and then press ENTER to quit psql . As of PostgreSQL 11, the keywords " quit " and " exit " in the PostgreSQL command-line interface have been included to help make it easier to leave the command-line tool.

What does psql command do?

psql is a terminal-based front-end to PostgreSQL. It enables you to type in queries interactively, issue them to PostgreSQL, and see the query results. Alternatively, input can be from a file or from command line arguments.


1 Answers

You can try setting in the psql prompt

\set HISTCONTROL ignoredups

you can also set it in a file called .psqlrc in the user home directory example from my .psqlrc file

\set HISTCONTROL ignoredups
\set COMP_KEYWORD_CASE upper
like image 105
Vamsi Krishna B Avatar answered Sep 21 '22 06:09

Vamsi Krishna B