将CSV复制到Amazon RDS托管的Postgresql数据库 [英] Copying CSV to Amazon RDS hosted Postgresql database

查看:74
本文介绍了将CSV复制到Amazon RDS托管的Postgresql数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Amazon的RDS服务托管的数据库,并且我试图编写一个将更新所述数据库的Web服务.我遇到的问题是,当我收到以下错误消息时,它不会让我使用COPY命令:错误:必须超级用户才能对文件进行COPY操作".我使用的是我为数据库创建的唯一用户,并且我可以肯定它具有超级用户访问权限.但是,我可以使用PGAdmin的导入工具来导入数据,当查看日志时,该数据几乎与我使用的命令完全相同.唯一的区别是它具有标准输入,而不是文件路径.如何解决此错误?

I have a database hosted using Amazon's RDS service and I am attempting to write a web service that will update said database. The problem I am having is that it will not let me use the COPY command as I get this error: "ERROR: must be superuser to COPY to or from a file". I am using the only user I have made for the database and I am fairly certain it has superuser access. I can, however, use PGAdmin's import tool to import the data which, when looking at the log, uses almost the exact same command as I do. The only difference is instead of the file path it has stdin. How can I fix this error?

推荐答案

您正在使用:

COPY tablename FROM 'filename';

这不起作用-RDS不知道文件名"是什么.

this won't work - RDS has no idea what 'filename' is.

您必须使用从本地客户端复制的psql命令的\copy或PgAdmin-III的导入数据"选项.

You must use the psql command's \copy, which copies from the local client, or PgAdmin-III's "import data" option.

RDS手册对此进行了更详细的介绍.

这篇关于将CSV复制到Amazon RDS托管的Postgresql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆