Export PostgreSQL database table header and data to CSV file

Other topics

Export PostgreSQL table to csv with header for some column(s)

COPY products(is_public, title, discount) TO 'D:\csv_backup\products_db.csv' DELIMITER ',' CSV HEADER;    

COPY categories(name) TO 'D:\csv_backup\categories_db.csv' DELIMITER ',' CSV HEADER;

Full table backup to csv with header

COPY products TO 'D:\csv_backup\products_db.csv' DELIMITER ',' CSV HEADER;    

COPY categories TO 'D:\csv_backup\categories_db.csv' DELIMITER ',' CSV HEADER;

copy from query

copy (select oid,relname from pg_class limit 5) to stdout;

Contributors

Topic Id: 8643

Example Ids: 26981,26982,30732

This site is not affiliated with any of the contributors.