我正在通过“PostGIS in Action”一书学习 PostgreSQL 和 PostGIS。我的问题来自 Pg。清单 3.4 中的 66。
我的代码如下:
CREATE TABLE ch03.paris_polygons(tags hstore, CONSTRAINT paris_polygons_pk PRIMARY KEY (gid)
)
INHERITS (ch03.paris);
ALTER TABLE ch03.paris_polygons NO INHERIT ch03.paris;
INSERT INTO ch03.paris_polygons(osm_id, ar_num, geom, tags, feature_name, feature_type)
SELECT osm_id, ar_num, ST_Multi(geom) As geom, tags, tags->'name',
COALESCE(tags->'tourism', tags->'railway','other')::varchar(50) As feature_type
FROM ch03.paris_hetero
WHERE ST_GeometryType(geom) LIKE '%Polygon';
SELECT populate_geometry_columns('ch03.paris_polygons'::regclass);
ALTER TABLE ch03.paris_polygons INHERIT ch03.paris;
运行代码后我收到此错误:
ERROR: child table "paris_polygons" has different type for column "geom"
SQL state: 42804
我用谷歌搜索找到了这个:
-204 (ECPG_INT_FORMAT)
The host variable is of type int and the datum in the database is of a different type and contains a value that cannot be interpreted as an int. The library uses strtol() for this conversion. (SQLSTATE 42804)
psql 命令会帮助我了解如何合并这些命令吗?
再次感谢所有的帮助!