Reputation: 359
Currently, I am using PostgreSQL 11.2 and I have a ~4GB .csv file. Firstly I am trying to create a temporary table and select the needed columns to fill my current table.
create temporary table t (identification varchar, a1 text, a2 text, a3 text, a4 text, a15 text, a6 text, a7 text, a8 text)
copy t
from 'C:\PostgreSqlData\mydata.csv'
delimiter ',' csv
If I get some smaller portion of data(~10MB), it does not give any errors. But, when I try to import the whole file, it gives:
could not stat file "mydata.csv”: unknown error
Upvotes: 8
Views: 12210
Reputation: 3714
First check that psql is already installed.
Open your terminal
Run the psql command :
Try this way
psql -c "COPY tablename FROM 'C:\PostgreSqlData\mydata.csv' delimiter ',' csv;"
Upvotes: 3