|< < 7 > >|

psql

With a script

Put the commands in a script, e.g. test.sql

create table t(x int); insert into t values (1), (2), (3); select * from t;

Run the script

jao@mintyzack ~ $ psql jao < test.sql Pager usage is off. CREATE TABLE INSERT 0 3 x --- 1 2 3 (3 rows)
  • psql jao < test.sql: Run psql on the database jao, piping in test.sql.

  • The commands in this file will be executed, and then psql will exit.

|< < 7 > >|