提供 postgres windows 系统复制权限(windows 8) [英] Providing postgres windows system permission for copy (windows 8)
问题描述
我希望使用 pgadmin iii 复制 CSV 文件.对此非常陌生.
I'm looking to copy CSV files using pgadmin iii. Very new to this.
当我从查询构建器运行复制"命令时,出现以下错误:
When I run a "copy" command from the query builder, I'm getting the following error:
ERROR: could not open file 'C:\\Users\\Nick\\Documents\\CDR\\csv1.csv" for reading: Permission denied SQL state: 42501
我发现这提到了其他几个地方(此处 此处和here 例如,一般的解决方法是在文件权限中添加postgres"(人们也建议将 csv 移动到公共文件夹,但这会由于其他原因导致问题).
I've found this mentioned a few other places (here here, and here for example , and the general fix is to add "postgres" to the file permissions (people also advise moving csv to the public folder, but this causes problems for other reasons).
但是当我尝试将 postgres 添加到 Windows 8 中具有权限的人时,当我检查名称时,我收到找不到对象 postgres"错误.
But when I try to add postgres to the people with permissions in Windows 8, when I check the name I get an "the object postgres cannot be found" error.
如果我添加Everyone",它会起作用,但出于显而易见的原因,我不想留下具有Everyone"访问权限的重要文件夹.
If I add "Everyone" it works, but for obvious reasons I won't want to leave an important folder with "Everyone" access.
谁能就如何在 Windows 8 中授予 postgres 权限提出建议?
Can anyone please advise on how to give postgres permissions in Windows 8?
谢谢!
推荐答案
最新版本的 PostgreSQL for windows 不使用 postgres
操作系统帐户,它们使用 NetworkService
系统帐户.这是在 Windows 中 PostgreSQL 服务的属性中指定的.这大概是 the object postgres cannot be found
错误的原因.无论如何都不需要更改文件的权限.
Recent versions of PostgreSQL for windows don't use the postgres
OS account, they use a NetworkService
system account instead. This is specified in the properties of the PostgreSQL service in Windows. That's presumably the reason of the object postgres cannot be found
error. Changing the permissions of the file is not really needed anyway.
最新版本的 pgAdmin (1.16+) 能够将 COPY 内容从客户端传送到服务器,而无需服务器打开文件.右键单击对象浏览器中的表名称,然后查看名为 Import
的菜单.在内部,这将使用 COPY FROM STDIN
变体.
Recent versions of pgAdmin (1.16+) are able to feed COPY contents from the client to the server without having the server to open the file. Right-click on a table name inside the object browser and check out a menu called Import
. Internally this will use the COPY FROM STDIN
variant.
如果这不令人满意,还可以选择使用 psql.exe
命令行工具及其 \copy
命令.此命令与 SQL COPY
命令具有相同的功能和语法,不同之处在于它将文件从客户端流式传输到服务器,而不是让服务器自行打开它.如果您面向 CLI,请将其作为您的首选,它比 pgAdmin 更容易.
If that's not satisying, there's also the the option of using the psql.exe
command line tool and its \copy
command. This command has the same functionality and syntax as the SQL COPY
command except that it streams the file from client to server instead of having the server open it itself. If you're CLI-oriented, make it your premium choice, it's easier than pgAdmin.
这篇关于提供 postgres windows 系统复制权限(windows 8)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!