Nyx*_*nyx 1 sql postgresql postgis postgresql-9.1
创建视图时,我收到错误function populate_geometry_columns(unknown) is not unique.我正在阅读的一本书使用了这个,但它给了我一个错误.我可能出了什么问题?
查询:
CREATE OR REPLACE VIEW ch03.vw_paris_points AS
SELECT gid, osm_id, ar_num, geom,
tags->'name' As place_name,
tags->'tourism' As tourist_attraction
FROM ch03.paris_hetero
WHERE ST_GeometryType(geom) = 'ST_Point';
SELECT populate_geometry_columns('ch03.vw_paris_points');
Run Code Online (Sandbox Code Playgroud)
错误:
ERROR: function populate_geometry_columns(unknown) is not unique
LINE 1: SELECT populate_geometry_columns('ch03.vw_paris_points');
^
HINT: Could not choose a best candidate function. You might need to add explicit type casts.
********** Error **********
ERROR: function populate_geometry_columns(unknown) is not unique
SQL state: 42725
Hint: Could not choose a best candidate function. You might need to add explicit type casts.
Character: 8
Run Code Online (Sandbox Code Playgroud)
从精细手册:
概要
Run Code Online (Sandbox Code Playgroud)text Populate_Geometry_Columns(boolean use_typmod=true); int Populate_Geometry_Columns(oid relation_oid, boolean use_typmod=true);
因此,有两个可能的populate_geometry_columns函数可以使用一个参数调用,而且没有TEXT参数.错误消息告诉您PostgreSQL不知道它是否应该隐式地将您的'ch03.vw_paris_points'字符串转换为a boolean或a oid.我的人脑建议您想要oid版本:
SELECT populate_geometry_columns('ch03.vw_paris_points'::regclass);
-- add an explicit cast -------------------------------^^^^^^^^^^
Run Code Online (Sandbox Code Playgroud)
但PostgreSQL的软件大脑只看到一个字符串而感到困惑.也许单一的论证形式populate_geometry_columns比你正在阅读的书更新.