Thursday, June 2, 2011

Loading csv files into postgres from remote machine

Could not find it easily anywhere, so here it goes:
psql -h 192.168.0.1 -d database_name -U postgres -c "\copy tablename from 'contents_file.csv' with csv header