Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jeffjohnson9046
Last active August 3, 2019 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffjohnson9046/51be2ce35fc5652a76f0cad67a41d718 to your computer and use it in GitHub Desktop.
Save jeffjohnson9046/51be2ce35fc5652a76f0cad67a41d718 to your computer and use it in GitHub Desktop.
A .psqlrc file gathered from various sources, for use with PostgreSQL
-- Set client encoding
\encoding UTF8
\set QUIET 1
-- print 'NULL' (instead of a blank) for any columns that have a null value
\pset null 'NULL'
-- Do not automatically commit after every statement
\set AUTOCOMMIT off
-- Set auto-completed keywords to upper case
\set COMP_KEYWORD_CASE upper
-- Verbose feedback
\set VERBOSITY verbose
-- Keep a separate history file for each database
\set HISTFILE ~/.psql_history- :DBNAME
-- Ignore duplicate entries and lines that begin with a space
\set HISTCONTROL ignoreboth
-- print 'NULL' (instead of a blank) for any columns that have a null value
\pset null 'NULL'
-- Use 'pretty' unicode lines when displaying results
\pset linestyle unicode
-- Draw a border around the outside of query results
\pset border 2
-- Wrap long lines so they will fit in the display
\pset format wrapped
-- Scroll results automatically
\pset pager off
-- Display how long queries take to run
\timing
-- Change to the "expanded" view when rows are too wide to fit
\x auto
-- Set the prompt. Leave the PROMPT2 empty, making it easier to copy multiline queries from
-- psql to other editors
\set PROMPT1 '%n@%m:%>/%/%x%# '
\set PROMPT2 ''
-- Set bytea output to show as many ASCII letters as possible.
-- (Handy if you are storing text whose encoding you do not know in bytea columns.)
set bytea_output to escape; commit;
\unset QUIET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment