I am trying to upload a large amount of dummy data into my pgadmin tables. I was able to use a csv for the smaller tables however I have a larger spreadsheet of data that includes descriptions (with punctuation marks like {'`, which could be causing the upload problem).

I am getting the below error message but I am unable to figure out what it means. I have went through the large bodies of text to remove any marks I think may have been causing it but I am still getting the same error.

Is there a better way to do this as the import tool seems to have a lot of bugs?

"C:\\Program Files (x86)\\pgAdmin 4\\v4\\runtime\\psql.exe" --command " "\\copy public.\"marineLifes\" (\"marineLifeID\", \"marineTypeID\", \"marineName\", \"marineDescription\") FROM 'C:/Users/JAMESG~1/Desktop/MARINE~1.CSV' CSV QUOTE '\"' ESCAPE '''';"" 

1 Answer

If you have a proper CSV file, with header row matching fields in existing table, you can import it this way:

  1. Open your CSV file in text editor

  2. Add this line as first line in file, just above header:

COPY public."marineLifes" FROM STDIN WITH (FORMAT CSV, HEADER ON) 
  1. Add this line (consisting only of COPY terminator) as the last line, just after last row:
\. 
  1. Save the file as tmp.sql.

  2. Run the file with psql:

C:\...\psql.exe -f C:\...\tmp.sql 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy