-
Notifications
You must be signed in to change notification settings - Fork 0
/
psqlrc
52 lines (36 loc) · 1.47 KB
/
psqlrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
-- turn quiet on for my prompt setup
\set QUIET 1
-- setup custom history file and size
\set HISTFILE ~/.psql_history-harrison- :DBNAME
\set HISTSIZE 2000
\set HISTCONTROL ignoredups
-- setup prompt with colors
\set PROMPT1 '%[%033[0;31m%][%[%033[1;37m%]%M%[%033[0;31m%]]:%[%033[1;31m%]%>%[%033[0m%] %n@%[%033[1;36m%]%/%[%033[0m%]%R%#%x '
\set PROMPT2 '%[%033[0;31m%][%[%033[1;37m%]%M%[%033[0;31m%]]:%[%033[1;31m%]%>%[%033[0m%] %n@%[%033[1;36m%]%/%[%033[0m%]%R%#%x '
-- turn on interactive error rollbacks
\set ON_ERROR_ROLLBACK interactive
-- stop on all errors
\set ON_ERROR_STOP ON
-- null values are empty by default, so print '(null)' instead
\pset null '(null)'
-- wrap long output
\pset format wrapped
-- show the timing of every query
\timing
-- turn on verbose mode for better errors while debugging
\set VERBOSITY verbose
-- turn on auto display mode for better formatting
\x auto
-- Custom Commands:
-- :clear -- clears the screen
\set clear '\\! clear'
-- :pgqueries -- shows information about currently running queries
\set pgqueries 'select db, pid, t_run, q_run, status, application_name, query from vw_queries;'
-- :email -- get entity by email_address or pk
\set email 'select * from tb_entity where email_address ilike '
-- :entity -- get entity by pk
\set entity 'select * from tb_entity where entity = '
-- :roles -- list the roles
\set roles 'select role,label,description,abbreviation,rank from tb_role order by rank '
-- turn quiet off when we're done
\set QUIET 0