4

我正在尝试在我具有只读访问权限的 postgres 实例(v8.0.2)上将查询结果本地下载为 csv。我已经真正阅读了 10 种不同的解决方法,并尝试全部实现它们(hereherehereherehere),但每次尝试执行复制命令时,都会出现以下错误:

ERROR:  syntax error at or near "STDOUT"

这是我尝试过的大约 20 个排列中的五个。foo_bar 表是作为查询输出创建的临时表。

=> \copy "pg_temp_5.foo_bar" TO '/Users/baz/Downloads/foo_bar.csv' DELIMITER ',' CSV
ERROR:  syntax error at or near "STDOUT"
LINE 1: COPY  "pg_temp_5.foo_bar" TO STDOUT DELIMITER ',' CSV

=> \copy "pg_temp_5.foo_bar" TO '/Users/baz/Downloads/foo_bar.csv' CSV
ERROR:  syntax error at or near "STDOUT"
LINE 1: COPY  "pg_temp_5.foo_bar" TO STDOUT CSV

=> \copy "pg_temp_5.foo_bar" TO '/Users/baz/Downloads/foo_bar.csv' WITH FORMAT "csv"
ERROR:  syntax error at or near "STDOUT"
LINE 1: COPY  "pg_temp_5.foo_bar" TO STDOUT WITH FORMAT "csv"

=> \copy pg_temp_5.foo_bar TO '/Users/baz/Downloads/foo_bar.csv' With CSV
ERROR:  syntax error at or near "STDOUT"
LINE 1: COPY  pg_temp_5.foo_bar TO STDOUT With CSV

=> \copy foo_bar TO foo_bar.csv With CSV
ERROR:  syntax error at or near "STDOUT"
LINE 1: COPY  foo_bar TO STDOUT With CSV

我认为这不是权限问题,就好像它是,当我尝试运行命令时会抛出“权限被拒绝”。我也知道这里的 postgres 记录的 \copy 命令也存在类似的问题,但是对于我的情况没有特别指出。任何帮助将不胜感激!

4

0 回答 0