From 8525d376507c80240a804f0b2c2a76e91a230471 Mon Sep 17 00:00:00 2001 From: Jeremy Kaplan Date: Wed, 5 Mar 2025 11:12:10 -0500 Subject: [PATCH] zsh: Add psql-ro alias for read-only psql connections --- default.conf.yaml | 3 ++- psql/.psqlrc-readonly | 3 +++ zsh/aliases | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 psql/.psqlrc-readonly diff --git a/default.conf.yaml b/default.conf.yaml index 90edef7..b27c263 100644 --- a/default.conf.yaml +++ b/default.conf.yaml @@ -7,7 +7,7 @@ - ./bin/set-colors - ./task/install -- clean: ['~', '~/.config'] +- clean: ["~", "~/.config"] - link: ~/bin: bin/ @@ -33,6 +33,7 @@ ~/.my.cnf: mysql/.my.cnf ~/.npmrc: npm/.npmrc ~/.psqlrc: psql/.psqlrc + ~/.psqlrc-readonly: psql/.psqlrc-readonly ~/.rgignore: etc/rgignore ~/.tmux.conf: tmux/.tmux.conf ~/.vimrc: vim/.vimrc diff --git a/psql/.psqlrc-readonly b/psql/.psqlrc-readonly new file mode 100644 index 0000000..761012d --- /dev/null +++ b/psql/.psqlrc-readonly @@ -0,0 +1,3 @@ +\pset expanded auto + +SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY; diff --git a/zsh/aliases b/zsh/aliases index d58c454..fff95b5 100644 --- a/zsh/aliases +++ b/zsh/aliases @@ -29,6 +29,8 @@ alias filestamp='date --utc "+%Y%m%dT%H%M%S"' alias see='pee "cat >&2"' +alias psql-ro='PSQLRC=~/.psqlrc-readonly psql' + docker-ip() { docker inspect "$1" --format='{{.NetworkSettings.Networks.bridge.IPAddress}}' }