giovedì 28 settembre 2017

Run a PostgreSQL .sql file using command line arguments

I have some .sql files with thousands of INSERT statements in them and need to run these inserts on my PostgreSQL database in order to add them to a table.
The files are that large that it is impossible to open them and copy the INSERT statements into an editor window and run them there.

You can use the following by navigating to the bin folder of your PostgreSQL install:

psql -U username -d myDataBase -a -f myInsertFile

You have four choices to supply a password: 

Nessun commento: