I'm attempting to import a CSV file into a database via the "COPY" command; however, I get the (what seems common) error that I need to be a superuser and that I should use "\copy" instead. However, when using \copy, I get a syntax error:
ERROR: syntax error at or near "\" LINE 1: \copy
With the caret pointing to "\". Here's my query:
\copy tablename(column2, column3, column4, column5) from '/home/uploads/data.csv' WITH DELIMITER ',' CSV HEADER'
I tried both "copy" and "\copy". The first giving me a superuser error the latter giving me that syntax error. Any idea on how to fix it? make it work?
I'm executing the command via myPgAdmin's sql input field.
The only other question I have is concerning the importing of the columns via tablename(column2, column3 and so on. Is that the correct syntax for that?