export table to csv on postgres

前端 未结 5 1313
甜味超标
甜味超标 2021-02-05 13:56

How can I export a table to .csv in Postgres, when I\'m not superuser and can\'t use the copy command?

I can still import the data to postgres

5条回答
  •  南旧
    南旧 (楼主)
    2021-02-05 14:58

    Use psql and redirect stream to file:

    psql -U  -d  -c "COPY  TO stdout DELIMITER ',' CSV HEADER;" > file.csv
    

提交回复
热议问题