在 Amazon RDS 上安装 PostGIS

Installing PostGIS on Amazon RDS

我正在尝试遵循 AWS 文档中的指南:http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.html#Appendix.PostgreSQL.CommonDBATasks.PostGIS

在 "Step 2: Load the PostGIS extensions" 上,在文档中它显示 (4 rows) 但那里有三行。 运行 到那时我自己执行相同的命令,我看到四行,文档中缺少的行是 tiger_data。在第 3 步中,tiger_data 的所有权是否也应授予 rds_superuser?

在 "Step 4: Transfer ownership of the objects to the rds_superuser role" 中,我在使用文档中提供的查询时遇到语法错误,我不知道该怎么办:

postgres=> CREATE FUNCTION exec(text) returns text language plpgsql volatile AS $f$ BEGIN EXECUTE ; RETURN ; 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

在我看来,这像是文档中的错字 - 有一个 , 而应该有一个 ;。正在构造的查询是:

ALTER TABLE tiger.loader_variables OWNER TO rds_superuser,

但应该是:

ALTER TABLE tiger.loader_variables OWNER TO rds_superuser;

因此将 SELECT 行更改为:

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