Skip to content

Instantly share code, notes, and snippets.

@joshleaves
Created January 24, 2025 20:40
Show Gist options
  • Select an option

  • Save joshleaves/583ce4fd16224ff3cec716e00e44edbe to your computer and use it in GitHub Desktop.

Select an option

Save joshleaves/583ce4fd16224ff3cec716e00e44edbe to your computer and use it in GitHub Desktop.
Powerline PSQL
\set QUIET 1
\pset null '[NULL]'
\x auto
SELECT CASE WHEN inet_server_addr() IS NULL THEN '(SAFE)' ELSE '(UNSAFE)' END AS safety \gset
SELECT CASE WHEN inet_server_addr() IS NULL THEN '2' ELSE '1' END AS safety_color \gset
\set PROMPT1 '%[%033[0;34;40m%] %/%[%033[0;31;40m%]@SQL%[%033[0;3%:safety_color::40m%]%:safety: %[%033[0;30;44m%]⮀ %/ %[%033[0;34;4%:safety_color:m%]⮀%[%033[0;30;4%:safety_color:m%] %R %[%033[0;3%:safety_color:;40m%]⮀%[%033[0m%] '
\set PROMPT2 '%R '
\set VERBOSITY verbose
\set HISTFILE ~/.psql_history- :DBNAME
\set HISTCONTROL ignoredups
\set COMP_KEYWORD_CASE upper
\set QUIET 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment