I need to copy table data into text file on Windows in csv format. How to do that?
What I have tried:
COPY test TO '"E:\\test.csv"' DELIMITER ',' CSV HEADER;
I am receiving an error while executing this query. That test.csv
file have to create first before copying data into that.
ERROR: relative path not allowed for COPY to file SQL state: 42602
This will work providing you have permissions. It will put the csv file at the root directory of the same drive that Postgresql is installed on, probably C:
COPY test TO '\test.csv' DELIMITER ',' CSV HEADER;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.