1. Access psql
$psql -U postgres user
Explanation) Accessing a database called user with a postgres account
2. Enter the copy command for csv extraction
$COPY (SELECT* FROM test) TO 'D:\test.csv' With CSV DELIMITER ',';
Explanation) Store the data in the table called test on the D drive in CSV format
Have a good day!