在Amazon RDS上设置PostGis

时间:2014-02-17 20:08:16

标签: postgresql amazon-web-services postgis amazon-rds

好的,所以我对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 | {}

1 个答案:

答案 0 :(得分:16)

在RDS上设置PostGIS的官方指南是here

这对我有用。

我仍然无法导入数据,获取:

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

关于那些的任何想法?
此外,是否可以以rdsadmin身份登录?