I want to export the data in a table of some PostgreSQL database to a csv file. Since the standard copy command does not work, I tried the following:
\copy (SELECT * FROM persons) to 'C:\tmp\persons_client.csv' with csv
just as in http://www.postgresqltutorial.com/export-postgresql-table-to-csv-file/ . The path seems to be correct; however, I get the error message
FEHLER: Syntaxfehler bei »\«
LINE 1: \copy [...]
which means that there is a syntax error at the "\" sign before the copy statement. Any ideas what I missed?
By the way, this is not the real problem I'm currently facing. Actually I was trying to import a csv file but unfortunately I do not seem to have sufficient privileges and when just using "COPY", the permission will be denied. so I tried to import the file using "\copy" but still get the same error message I get when trying to export using "\copy".