0

psql (9.6.7, server 9.5.2) on linux

I have an init script... ~/sql.ini that I always want to run after connecting to a PG DB. I can do this by typing "\i ~/sql.ini", but is there a way to do this on the command line (which I alias) ?

2 Answers 2

1

Just put your commands in ~/.psqlrc file.

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

1 Comment

That did it. Thanks pensnarik !
0

Your alias should call

PSQLRC=~/sql.ini psql

That environment variable specifies the startup file that psql executes automatically.

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.