1

When you start interactive bash, it runs .bashrc first and then it gives you an interactive prompt. Very handy to setup bash in the right way.

I'm trying to do the same with Postgres client (psql). I want to set some session configuration parameters before I run SQL statements interactively. Does psql let me do that?

The -c option and the -f option are the standard ways to run a pre-canned SQL statements, but the man page clearly states that those options are incompatible with the interactive mode.

1
  • Amazing enough psql has a psqlrc file. See here psql under the section "Files" at bottom pf page. Or search for psqlrc in the page. Commented Aug 11, 2021 at 22:52

1 Answer 1

2

The analogy to .bashrc extend to the name as well. You want .psqlrc

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.