开发者

Using COPY FROM in postgres - absolute filename of local file

I'm trying to import开发者_StackOverflow社区 a csv file using the COPY FROM command with postgres.

The db is stored on a linux server, and my data is stored locally, i.e. C:\test.csv

I keep getting the error:

ERROR: could not open file "C:\test.csv" for reading: No such file or directory SQL state: 58P01

I know that I need to use the absolute path for the filename that the server can see, but everything I try brings up the same error

Can anyone help please? Thanks


Quote from the PostgreSQL manual:

The file must be accessible to the server and the name must be specified from the viewpoint of the server

So you need to copy the file to the server before you can use COPY FROM.

If you don't have access to the server, you can use psql's \copy command which is very similar to COPY FROM but works with local files. See the manual for details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜