postgresql – 在Amazon RDS上设置PostGis

前端之家收集整理的这篇文章主要介绍了postgresql – 在Amazon RDS上设置PostGis前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
好的,所以我对RDS和AWS来说是相当新的,但是对于我来说,我的生活不能让我在笔记本电脑上创建的数据库到亚马逊RDS,我把它移动到了我的测试VPS,还有我的台式机没有任何问题,这里是我迄今为止所尝试的
create extension postgis;
create extension fuzzystrmatch;
create extension postgis_tiger_geocoder;
create extension postgis_topology;
alter schema tiger owner to rds_superuser;
alter schema topology owner to rds_superuser;

CREATE FUNCTION exec(text) returns text language plpgsql volatile AS $f$BEGIN EXECUTE $1; RETURN     $1; END; $f$;
SELECT exec('ALTER TABLE ' || quote_ident(s.nspname) || '.' || quote_ident(s.relname) || ' OWNER TO rds_superuser')
  FROM (
    SELECT nspname,relname
    FROM pg_class c JOIN pg_namespace n ON (c.relnamespace = n.oid) 
    WHERE nspname in ('tiger','topology') AND
    relkind IN ('r','S','v') ORDER BY relkind = 'S')
s;        

GRANT ALL PRIVILEGES ON DATABASE testgetwork TO luke;

然后我连接到数据库,并尝试加载我的新数据库的本地副本…

luke@l-xps:~$psql --host=myhost.dns.us-west-2.rds.amazonaws.com --port=5432 --username=luke --password --dbname=testgetwork < testgetwork.sql 
Password for user luke: 
SET
SET
SET
SET
SET
ERROR:  schema "topology" already exists
ALTER SCHEMA
CREATE EXTENSION
ERROR:  must be owner of extension plpgsql
CREATE EXTENSION
ERROR:  must be owner of extension postgis
CREATE EXTENSION
ERROR:  must be owner of extension postgis_topology

<more output,removed to save space>

ERROR:  permission denied for relation spatial_ref_sys
invalid command \.
 setval 
-------- 
      1
(1 row)

 setval 

<more output,removed to save space>

我的问题是,我该怎么办?所有的功能似乎被一个权限问题阻止,用户luke是rds_superuser组的一部分,任何有PostGis和RDS经验的人都知道如何纠正这个问题?

testgetwork=> \du
                                  List of roles
   Role name   |                   Attributes                   |    Member of    
---------------+------------------------------------------------+-----------------
 luke          | Create role,Create DB                         | {rds_superuser}
 rds_superuser | Cannot login                                   | {}
 rdsadmin      | Superuser,Create role,Create DB,Replication | {}
RDS设立PostGIS的官方指南是 here.

这对我有用

我仍然有问题导入我的数据,得到:

...
must be superuser to create a base type
permission denied for language c
....

有什么想法吗?另外,是否可以以rdsadmin身份登录

猜你在找的Postgre SQL相关文章