您没有做错任何事,发现我们对PostgreSQL 9.3的新物化视图功能的支持存在漏洞。我已经修补了所有相关的分支,并且您可以自己更新geometry_columns的定义(请参阅此故障单中的更改参考http://trac.osgeo.org/postgis/ticket/2511)
实际上,您可以将以下内容粘贴到“ SQL”窗口中:
CREATE OR REPLACE VIEW geometry_columns AS
SELECT current_database()::varchar(256) AS f_table_catalog,
n.nspname::varchar(256) AS f_table_schema,
c.relname::varchar(256) AS f_table_name,
a.attname::varchar(256) AS f_geometry_column,
COALESCE(NULLIF(postgis_typmod_dims(a.atttypmod),2),
postgis_constraint_dims(n.nspname, c.relname, a.attname),
2) AS coord_dimension,
COALESCE(NULLIF(postgis_typmod_srid(a.atttypmod),0),
postgis_constraint_srid(n.nspname, c.relname, a.attname),
0) AS srid,
-- force to be uppercase with no ZM so is backwards compatible
-- with old geometry_columns
replace(
replace(
COALESCE(
NULLIF(upper(postgis_typmod_type(a.atttypmod)::text), 'GEOMETRY'),
postgis_constraint_type(n.nspname, c.relname, a.attname),
'GEOMETRY'
), 'ZM', ''
), 'Z', ''
)::varchar(30) AS type
FROM pg_class c, pg_attribute a, pg_type t, pg_namespace n
WHERE t.typname = 'geometry'::name
AND a.attisdropped = false
AND a.atttypid = t.oid
AND a.attrelid = c.oid
AND c.relnamespace = n.oid
AND (c.relkind = 'r'::"char" OR c.relkind = 'v'::"char" OR c.relkind = 'm'::"char")
AND NOT pg_is_other_temp_schema(c.relnamespace)
AND NOT ( n.nspname = 'public' AND c.relname = 'raster_columns' )
AND has_table_privilege( c.oid, 'SELECT'::text );