The -d yourdatabase
option connects to this database once psql has started.
The -f file.sql
option says to load file.sql and execute all the SQL commands it contains.
If you're already inside psql
, the equivalent commands would be:
\c yourdatabase
: connect to the db named yourdatabase
.
\i file.sql
: loads file.sql
and execute all commands in it. It should be in the current path, otherwise specify a full path.