ERROR: must be superuser to COPY to or from a file

来源:互联网 发布:茄子换机软件 编辑:程序博客网 时间:2024/05/18 14:13

用COPY需要superuser很麻烦

直接用 \copy就可以把file导入到表中了


> Hello> > I want to fill in a table from a file, but when I use the COPY command I> > get the following error:> >> > mydb=> COPY weather FROM '/home/fideito/weather.txt';> > ERROR:  must be superuser to COPY to or from a file> > HINT:  Anyone can COPY to stdout or from stdin. psql's \copy command> > also works for anyone.> >> > But, what can I do if I'm not root?

Use \copy (as the error message suggests) rather than copy.  That shoulddo it.

0 0