Skip to content

Instantly share code, notes, and snippets.

@torkildr
Last active December 4, 2018 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torkildr/8e808c8d33bd5e5443d23a96cad28c89 to your computer and use it in GitHub Desktop.
Save torkildr/8e808c8d33bd5e5443d23a96cad28c89 to your computer and use it in GitHub Desktop.
psqlrc-file to clearly indicate difference between the staging and production postgres cluster instance
-- psqlrc to clearly indicate difference between the staging and production postgres cluster instance
SHOW cluster_name
\gset
SELECT
:'cluster_name' LIKE '%production%' AS is_production,
:'cluster_name' LIKE '%staging%' AS is_staging
\gset
\if :is_production
\set PROMPT1 '%[%033[1;93;41m%]%:cluster_name:%[%033[0m%] %n@%/%R%# '
\elif :is_staging
\set PROMPT1 '%[%033[1;97;44m%]%:cluster_name:%[%033[0m%] %n@%/%R%# '
\else
\set PROMPT1 '%:cluster_name: %n@%/%R%# '
\endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment