aliasing psql
When you run
psql
without arguments, then the psql
tries to connect to database named like current user. I dislike this behave. Surely I have not database "pavel". There is trivial solution - add to your .bashrc code:function psql { if [[ $# -eq 0 ]]; then env psql postgres else env psql "$@" fi }
3 Comments:
Alternatively use the ENV:
export PGDATABASE=postgres
in .bashrc/.zshrc or similar
@anonymous: good to know, thank you
Similarly, you can set things like PGSERVICE in your environment if you're using psql to access remote systems most of the time. There are a fair number of other customizations of this type. http://www.postgresql.org/docs/9.5/static/app-psql.html#AEN9442
Post a Comment
Subscribe to Post Comments [Atom]
<< Home