-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpsqlrc.symlink
More file actions
51 lines (39 loc) · 1.49 KB
/
psqlrc.symlink
File metadata and controls
51 lines (39 loc) · 1.49 KB
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
-- http://www.postgresql.org/docs/9.4/static/app-psql.html
-- Other good examples
-- https://gist.github.com/jaytaylor/e5aa89c8f3aaab3f576f
-- https://raw.githubusercontent.com/exhuma/dotfiles/refs/heads/master/.psqlrc
\setenv PAGER 'pspg --style=24 --ignore-case'
\pset linestyle unicode
\pset border 2
\pset format wrapped
\pset pager on
\x auto
\timing
-- Tab complete to upper case
\set COMP_KEYWORD_CASE upper
-- Stop invalidation of transaction on a query error
\set ON_ERROR_ROLLBACK on
-- Verbose error reports.
\set VERBOSITY verbose
-- Use a separate history file per-database.
\set HISTFILE ~/.psql_history- :DBNAME
-- If a command is run more than once in a row, only store it once in the
-- history.
\set HISTCONTROL ignoredups
-- export YELLOW=`echo -e '\033[1;33m'`
-- export LIGHT_CYAN=`echo -e '\033[1;36m'`
-- export NOCOLOR=`echo -e '\033[0m'`
-- PAGER="sed \"s/\([[:space:]]\+[0-9.\-]\+\)$/${LIGHT_CYAN}\1$NOCOLOR/;"
-- PAGER+="s/\([[:space:]]\+[0-9.\-]\+[[:space:]]\)/${LIGHT_CYAN}\1$NOCOLOR/g;"
-- PAGER+="s/|/$YELLOW|$NOCOLOR/g;s/^\([-+]\+\)/$YELLOW\1$NOCOLOR/\" 2>/dev/null | less"
-- export PAGER
-- \setenv PAGER "/usr/bin/less --ignore-case --no-init --RAW-CONTROL-CHARS --quit-if-one-screen --chop-long-lines"
-- Approximate count:
-- SELECT reltuples::bigint AS estimate
-- FROM pg_class
-- WHERE oid = 'myschema.mytable'::regclass;
-- '%/%R%x%# '
\set blue '%[%033[1;33;40m%]'
\set reset '%[%033[0m%]'
\set PROMPT1 '%:"blue":%m:%/%R%:"reset":%x%# '
\set PROMPT2 '%w%R%x%# '