COPY从CSV到Postgres在Ubuntu [英] COPY FROM CSV to Postgres in Ubuntu
问题描述
我的问题类似于此一个,但在Linux Mint 15(Ubuntu)中。我尝试了 COPY 标准(我在Windows上使用的标准)所有时间):
My question is similar to this one but in Linux Mint 15 (Ubuntu). I've tried the standard COPY (which I used on Windows all the time):
COPY public.bio FROM'tmp / sisinst_bio.csv'
DELIMITERS'|'CSV; code>
COPY public.bio FROM 'tmp/sisinst_bio.csv'
DELIMITERS '|' CSV;
我收到此错误:
错误:打开文件/tmp/sisinst_bio.csv以供阅读:权限被拒绝
数据库的所有者和用户 postgres
。
The owner and user of the database is postgres
.
尝试
(1)创建与我Ubuntu的用户帐户( zach
)并更改数据库的所有者。
(1) Creating a user that is the same as my user account for Ubuntu (zach
) and changing the owner of the database.
(2)将csv移动到Ubuntu的各个部分
(2) Moving the csv to various parts of Ubuntu
sudo cp -r /home/zach/Documents/Postgres91/sisinst_postgresql_bio_test.csv /usr/share/postgresql/9.1
sudo cp -r /home/zach/Documents/Postgres91/sisinst_postgresql_bio_test.csv / tmp
这很容易,但我被卡住了。我不知道这是 Postgresql
或 Ubuntu
问题。
This is really easy but I'm stuck. I'm not sure if this is Postgresql
or Ubuntu
problem.
更新
这与这?
一如既往,感谢所有
推荐答案
$ c> 中的权限
(右键单击
- > Properties
- > 权限
), Others
设置为 None
。
For the Permissions
in the CSV
(Right Click
-> Properties
-> Permissions
), the Others
was set to None
.
为了解决这个问题,用户可以使用 Postgres
,我更改了其他
到只读
工作。
To fix this so that Postgres
users can use it, I changed Others
to Read-only
which worked.
最终,在组$ c中
Postgres
Ultimately, it might be better have Postgres
users in a Group
but that's above me at this point.
我打开一个更好的答案。
I'm open to a better answer.
这篇关于COPY从CSV到Postgres在Ubuntu的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!