how to save csv file in postgresql database code example
Example 1: run postgresql dump to csv
\copy (SELECT * FROM persons) to 'C:\tmp\persons_client.csv' with csv
Example 2: postgresql export output table as a csv
COPY table_name TO 'file_name.csv' DELIMITER ',' CSV HEADER;