4 ms·
This is my psqlrc; I guess I'll share that here: -- Show row count of last query in prompt. -- Gosh, why did I do it like this...? There was a reason for i
by arp242 4y ago
This is my psqlrc; I guess I'll share that here:
-- Show row count of last query in prompt.
-- Gosh, why did I do it like this...? There was a reason for it and it fixes
-- something, but I forgot what.
select :'PROMPT1'='%/%R%x%# ' as default_prompt \gset
\if :default_prompt
\set PROMPT1 '(%:ROW_COUNT:)%R%# '
\endif
\set QUIET \\-- Don't print welcome message etc.
\set HISTFILE ~/.cache/psql-history- :DBNAME \\-- Keep history per database
\set HISTSIZE -1 \\-- Infinite history
\set HISTCONTROL ignoredups \\-- Don't store duplicates in history
\set PROMPT2 '%R%# ' \\-- No database name in the line continuation prompt.
\set COMP_KEYWORD_CASE lower \\-- Complete keywords to lower case.
\pset linestyle unicode \\-- Nicely formatted tables.
\pset footer off \\-- Don't display "(n rows)" at the end of the table.
\pset null 'NULL' \\-- Display null values as NULL
\timing on \\-- Show query timings
\set pretty '\\pset numericlocale' \\-- Toggle between thousands separators in numbers
Storing history per-database is really useful if you regularly connect to different unrelated databases.
I distinctly remember setting the prompt in such a funky way for a very specific reason; it took me a while to find a good solution. But for the life of me I can't remember why.
Set the PSQLRC environment variable to store it somewhere else (e.g. ~/.config/psqlrc).
- 1ba9115454 4y agoI didn't know you could do this. Thanks.