The broad question is can you set psql command line arguments within a sql script? Something simliar to SET

In particular, Postgresql psql has a -S option, which turns on --single-line. According to the postgresql documentation, this does the following:

   Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.

I have a sql file, and I want to pass it in with the -f option. Is there a way to set new line terminate a sql command in a file.

//do something to set --single-line
create table t1
select * from t1 

I know that you can run a bash script with a sql file, something like

 psql -S ...

I guess the broader question is

  • 1
    Have you looked at .psqlrc? See here and here for example. – Vérace Jul 29 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.