简体   繁体   English

在Amazon RDS上安装PostGIS

[英]Installing PostGIS on Amazon RDS

I am trying to follow this guide from AWS docs: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.html#Appendix.PostgreSQL.CommonDBATasks.PostGIS 我正在尝试从AWS文档中遵循本指南: http : //docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.html#Appendix.PostgreSQL.CommonDBATasks.PostGIS

On "Step 2: Load the PostGIS extensions", in the docs it shows (4 rows) but there are three rows there. 在“第2步:加载PostGIS扩展”上,在文档中显示(4 rows)但其中有3行。 Running the same commands myself up to that point, I see four rows, and the row that was missing from the docs is tiger_data . 到那时为止,我自己运行相同的命令,我看到了四行,而文档中缺少的行是tiger_data In Step 3, should ownership of tiger_data be given to rds_superuser as well? 在第3步中,是否还应该将tiger_data所有权授予rds_superuser?

In "Step 4: Transfer ownership of the objects to the rds_superuser role", I'm getting a syntax error from using the query provided in the docs and I don't know what to do about this: 在“第4步:将对象的所有权转让给rds_superuser角色”中,使用文档中提供的查询时遇到语法错误,我不知道该怎么办:

postgres=> CREATE FUNCTION exec(text) returns text language plpgsql volatile AS $f$ BEGIN EXECUTE $1; RETURN $1; END; $f$;
CREATE FUNCTION
postgres=> SELECT exec('ALTER TABLE ' || quote_ident(s.nspname) || '.' || quote_ident(s.relname) || ' OWNER TO rds_superuser,')
postgres->   FROM (
postgres(>     SELECT nspname, relname
postgres(>     FROM pg_class c JOIN pg_namespace n ON (c.relnamespace = n.oid)
postgres(>     WHERE nspname in ('tiger','topology') AND
postgres(>     relkind IN ('r','S','v') ORDER BY relkind = 'S')
postgres-> s;
ERROR:  syntax error at end of input
LINE 1: ALTER TABLE tiger.loader_variables OWNER TO rds_superuser,
                                                                  ^
QUERY:  ALTER TABLE tiger.loader_variables OWNER TO rds_superuser,
CONTEXT:  PL/pgSQL function exec(text) line 1 at EXECUTE statement

That looks to me like a typo in the docs - there is a , where there should be a ; 在我看来,这就像文档中的错字-有一个,应该有一个; . The query being constructed is: 正在构造的查询是:

ALTER TABLE tiger.loader_variables OWNER TO rds_superuser,

But should be: 但应为:

ALTER TABLE tiger.loader_variables OWNER TO rds_superuser;

So change the SELECT line to: 因此将SELECT行更改为:

SELECT exec('ALTER TABLE ' || quote_ident(s.nspname) || '.' || quote_ident(s.relname) || ' OWNER TO rds_superuser;')
FROM ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM