Last active
December 11, 2015 02:29
-
-
Save bidulock/4530751 to your computer and use it in GitHub Desktop.
my .psqlrc file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Include the hostname in the prompt, and add a * when in a transaction | |
-- The default PROMPT2 doesn't make it obvious enough nothing has been sent to the server yet | |
\set PROMPT1 '%M:%/%R%x%# ' | |
\set PROMPT2 '> ' | |
-- Always be in a transaction. It's safer this way | |
\set AUTOCOMMIT off | |
-- Turn the pager on always. This is best used with "export PAGER=less -S -F -X" added to your .bashrc | |
\pset pager always | |
-- History files stored in the .psql_history directory in the form <hostname>-<dbname> | |
\set HISTFILE ~/.psql_history/:HOST - :DBNAME | |
\set HISTSIZE 2000 | |
-- Always display timing information. | |
\timing | |
\encoding unicode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you add
\i .psql:HOST
to this file, you can have it load different configuration files depending on the host that you are connecting to.
In my production .psqlPRODUCTION file, I have inserted the line
\set PROMPT1 '%[%033[91m%]%M:%/%R%x%#%[%033[0m%] '
to turn the prompt red.