History of 2022-01-29 Running a script before (and after) starting the psql prompt

2022-01-29
09:56 UTC Revision 1 . . . . mborkAnd here I am again, with another PostgreSQL tip. Recently, I had a need of running psql interactively but executing some script first. Of course, this can be done from psql itself by saying \i some-script.psql, but let’s assume that I’d prefer for that to happen automatically, so that instead of typing psql at the shell prompt and then \i some-script.psql at the psql prompt I could just say psql-some-script.sh at the shell prompt and be done. The important thing here is that I want to run some-script.psql first and go to the psql prompt next.