LoginSignup
1
4

More than 1 year has passed since last update.

PostgresqlのRDSからCSVエクスポートする方法

Last updated at Posted at 2018-11-22

色々試して、結局 \COPY (SELECT * FROM XXX) の形じゃないと取れなかった。

psql -U aaa -h bbb.ccc.ap-northeast-1.rds.amazonaws.com -p 5432 -d eee -c "\COPY (SELECT * From public.fff_tables) TO '/tmp/fff_tables.csv' WITH CSV DELIMITER ','"

COPYはsuperuserじゃないと使えないと言われ(must be superuser to COPY to or from a fileとか言われる)、
\COPY table_nameだとなぜか0件で出力された。

1
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4