Skip to content

Instantly share code, notes, and snippets.

@sebastianvera
Created October 16, 2016 21:49
Show Gist options
  • Save sebastianvera/48259b175f7b56540b3f9f84b7570f72 to your computer and use it in GitHub Desktop.
Save sebastianvera/48259b175f7b56540b3f9f84b7570f72 to your computer and use it in GitHub Desktop.
-- Official docs: http://www.postgresql.org/docs/9.3/static/app-psql.html
-- Unofficial docs: http://robots.thoughtbot.com/improving-the-command-line-postgres-experience
-- Don't display the "helpful" message on startup.
\set QUIET 1
\pset null '[NULL]'
-- http://www.postgresql.org/docs/9.3/static/app-psql.html#APP-PSQL-PROMPTING
-- \set PROMPT1 '%[%033[38;5;214m%]%M[%033[0m% %n@%/%R%[%033[0m%]%# '
\set PROMPT1 '%[%033[38;5;203m%]%M%[%033[0m%] %n@%/%R%[%033[0m%]%# '
-- PROMPT2 is printed when the prompt expects more input, like when you type
-- SELECT * FROM<enter>. %R shows what type of input it expects.
\set PROMPT2 '[more] %R > '
-- Show how long each query takes to execute
\timing
-- Use best available output format
\x auto
\set VERBOSITY verbose
\set HISTFILE ~/.psql_history- :DBNAME
\set HISTCONTROL ignoredups
\set COMP_KEYWORD_CASE upper
\unset QUIET
-- psql can't check for a file's existence, so we'll provide an empty local
-- file that users can override with their custom dotfiles. To set your own
-- personal settings, place your own file in ~/.psqlrc.local
-- \i ~/.psqlrc.local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment