0

I want to execute a set of commands before executing other queries using psql

The following is what I want to execute

psql << EOF
\setenv PAGER 'pspg -s 0'
\pset pager always
EOF

After executing this, I want to have an interactive shell with these parameters set.

I am looking for how to get interactive shell after this.

1 Answer 1

1

psql has a built-in feature to set defaults: the ~/.psqlrc file.

You can put any command in there that should be executed when you start psql

So just create that file and put:

\setenv PAGER 'pspg -s 0'
\pset pager always

into it.

0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.