Thursday, November 12, 2015

Update in PostgresSQL Using the Command Line Tool - PSQL

The command:

psql -h hostname -d database -U username -W --echo-queries -f script-file-name.sql

where:

-W - to request psql to ask for password (rather then assume no-password)-h  - PostgreSql server host name or ip
-f  - file with the SQL script to execute on the database
 --echo-querries - shows the currently executed query for easier debugging of the script