Skip to content

Commit

Permalink
Allow psql to use a different history for each DB
Browse files Browse the repository at this point in the history
Co-authored-by: Jake Worth <jake.worth@hashrocket.com>
Co-authored-by: Philip Capel <phil.capel@hashrocket.com>

With this setting, psql will create a unique history file for each
database it connects to, in the format of
`.psql_history-your-database-name`.

This extends the number of commands that can be saved for each database
by isolating them, and reduces the chance of running a destructive
command in a remote psql session.

More info:

https://til.hashrocket.com/posts/c2cb0fd702-know-your-histfile
  • Loading branch information
hashrocketeer authored and jwworth committed Dec 19, 2019
1 parent 6e87738 commit 1bd581d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions .psqlrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
\x auto
\set QUIET 0
\timing
\set HISTFILE ~/.psql_history-:DBNAME

0 comments on commit 1bd581d

Please sign in to comment.