Save PL/pgSQL output from PostgreSQL to a CSV file

后端 未结 18 2370
名媛妹妹
名媛妹妹 2020-11-22 11:56

What is the easiest way to save PL/pgSQL output from a PostgreSQL database to a CSV file?

I\'m using PostgreSQL 8.4 with pgAdmin III and PSQL plugin where I run que

18条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 12:19

    I had to use the \COPY because I received the error message:

    ERROR:  could not open file "/filepath/places.csv" for writing: Permission denied
    

    So I used:

    \Copy (Select address, zip  From manjadata) To '/filepath/places.csv' With CSV;
    

    and it is functioning

提交回复
热议问题