-
Notifications
You must be signed in to change notification settings - Fork 2
/
.psqlrc
37 lines (30 loc) · 1.31 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
-- .psqlrc
-- Custom settings for psql client
-- Copyright (c) 2010-2024, Michael Paquier
\echo 'Option menu:'
\echo '\t:clear\t\t-- Clear screen'
\echo '\t:pid\t\t-- Show process PID'
\echo '\t:slaves\t\t-- Display slave activity'
\echo '\t:slots\t\t-- Display slot information'
\echo '\t:uptime\t\t-- Session uptime'
\echo '\t:version\t-- Show server version'
\echo ''
-- Set some default commands
\set clear '\\! clear;'
\set pid 'SELECT pg_backend_pid() AS pid;'
\set slaves 'SELECT application_name, pg_xlog_location_diff(sent_location, flush_location) AS replay_delta, sync_priority, sync_state FROM pg_stat_replication ORDER BY replay_delta ASC, application_name;'
\set slots 'SELECT slot_name, plugin, slot_type, restart_lsn, active FROM pg_replication_slots;'
\set uptime 'SELECT now() - backend_start AS uptime FROM pg_stat_activity WHERE pid = pg_backend_pid();'
\set version 'SELECT version();'
-- Set prompt to not print the name of database connected. The only thing
-- taken into account is if the user is superuser or not.
\set PROMPT1 '=%# '
-- Set default error output as verbose
\set VERBOSITY verbose
-- Output processing time for each query run
\timing on
-- Print null values as "null" and not empty things
\pset null 'null'
-- Private parameters
\! test ~/.psqlrc_extra && touch ~/.psqlrc_extra
\i ~/.psqlrc_extra