PostgreSQL 18 · Connecting

Run a SQL file

Execute the statements in a file and stop at the first error.

psql -U postgres -d mydb -v ON_ERROR_STOP=1 -f script.sql

Official PostgreSQL 18 documentation

More connecting commands

All connecting commands · PostgreSQL 18 cheatsheet

Was this page helpful?