7

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

eaytan
  • 319
  • 2
  • 3
  • 10

1 Answers1

3
  • 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;"
Schwern
  • 153,029
  • 25
  • 195
  • 336
Yassine CHABLI
  • 3,459
  • 2
  • 23
  • 43