How to export the resulting data in PostgreSQL to .CSV?

后端 未结 3 1824
离开以前
离开以前 2020-12-16 23:40

I use PostgreSQL 9.4.1

My query:

copy(select * from city) to \'C:\\\\temp\\\\city.csv\'
copy(select * from city) to E\'C:\\\\temp\\\\city.csv\'
         


        
3条回答
  •  甜味超标
    2020-12-17 00:03

    As with this case, it seems likely that you are attempting to use copy from a computer other than the one which hosts your database. copy does I/O from the database host machine's local file system only. If you have access to that filesystem, you can adjust your attempt accordingly. Otherwise, you can use the \copy command in psql.

提交回复
热议问题