消息:尽管文件存在,但psql csv导入失败

时间:2019-02-14 16:52:12

标签: postgresql csv import psql

尝试如下导入csv文件:

psql -h 127.0.0.1 -d jira_statistics -U admin -p 5432 -c "COPY bugs FROM '/home/centos/bugs.csv' delimiter '|' csv;"
Password for user admin: 
ERROR:  could not open file "/home/centos/bugs.csv" for reading: No such file or directory
HINT:  COPY FROM instructs the PostgreSQL server process to read a file. You may want a client-side facility such as psql's \copy.

但是文件都存在于jira_statistics数据库中

[root@jira-statistics ~]# ls /home/centos/bugs.csv
/home/centos/bugs.csv


[root@jira-statistics ~]# psql -h 127.0.0.1 -p 5432 -U admin jira_statistics
Password for user admin: 
psql (9.2.24, server 11.1 (Debian 11.1-3.pgdg90+1))
WARNING: psql version 9.2, server version 11.0.
         Some psql features might not work.
Type "help" for help.

jira_statistics=# \dt
         List of relations
 Schema |   Name   | Type  | Owner 
--------+----------+-------+-------
 public | bugs     | table | admin
 public | devtasks | table | admin
 public | releases | table | admin
 public | stories  | table | admin

0 个答案:

没有答案