My personal favorites: `\e` to edit your query in $EDITOR, and `psql service=my_db` to use saved connection params.
My personal favorites: `\e` to edit your query in $EDITOR, and `psql service=my_db` to use saved connection params.
The aspect of that that's hit me a few times recently is how unusual (but great) it is that it and all other (that I've needed, anyway) pg tools use the same args for connecting to a database in the same way.
Once I realised, I renamed the `psql` wrapper script I'd written (takes an arg for the namespace name, looks up correct RDS host etc. for it) to `pgenv`, adding another argument for the real executable to run (i.e. `psql` is now `pgenv real_psql "$@"`) so it can also be used with dump, upgrade, vacuum...
I learned about them recently, it's been a massive quality of life improvement.
[1]: https://www.postgresql.org/docs/current/libpq-pgpass.html
[2]: https://www.postgresql.org/docs/current/libpq-pgservice.html
Thanks though, I didn't know about the latter, and I think I've only heard of pgpass from error messages and such, not actually looked into it before.