Skip to content

Instantly share code, notes, and snippets.

@theoretick
Created February 10, 2016 17:54
Show Gist options
  • Save theoretick/5cd5a439ac29eb0d215c to your computer and use it in GitHub Desktop.
Save theoretick/5cd5a439ac29eb0d215c to your computer and use it in GitHub Desktop.
-- quiet outputs for setting these on psql start
\set QUIET 1
-- Custom Prompt
-- %M refers to the database server's hostname -- is "[local]" if the connection is over a Unix domain socket
-- %> refers to the listening port
-- %n refers to the session username
-- %/ refers the current database
-- %R refers to whether you're in single-line mode (^) or disconnected (!) but is normally =
-- %# refers to whether you're a superuser (#) or a regular user (>)
-- %x refers to the transaction status -- usually blank unless in a transaction block (*)
\set PROMPT1 '%M:%> %n@%/%R%#%x '
-- display NULLs as [null] instead of whitespace
\pset null '(null)'
-- disable the stupid pager
\pset pager off
-- notify interactively on errors
\set ON_ERROR_ROLLBACK interactive
-- complete SQL keywords in uppercase
\set COMP_KEYWORD_CASE upper
-- display query times
\timing
-- set history size to 2000
\set HISTSIZE 2000
-- use expanded table format for displaying long tables
\x auto
-- use verbose error reports
\set VERBOSITY verbose
-- unquiet outputs for displaying welcome greetings
\set QUIET 0
-- Greetings messages
\echo 'Welcome to PostgreSQL! \n'
\echo 'Type \\q to exit. \n'
-- shortcut aliases
\set version 'SELECT version();'
\set extensions 'select * from pg_available_extensions;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment