用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 should do it.