PostgreSQL 2018(2)Dump the Data to CSV
My data is pretty simple
>select * from usertable;
name signupdate
sillycat 2018-05-03
This Dump command will dump all the data to one csv file
>
copy (select name as "Name", signupdate as "SignupDate" from usertable) to '/Users/hluo/temp/user.csv' WITH (FORMAT CSV, HEADER, DELIMITER ',', ENCODING 'UTF8', FORCE_QUOTE *);
If my user can not do the copy command, we need to change the user to superuser with this command
>
alter user postgres superuser;
The Tool I use is SQLpro for Postgres
References:
http://sillycat.iteye.com/blog/2421981
PostgreSQL 2018(2)Dump the Data to CSV
猜你喜欢
转载自sillycat.iteye.com/blog/2422094
今日推荐
周排行