PostGIS错误:无法选择最佳候选函数 [英] PostGIS Error: Could not choose a best candidate function
问题描述
创建视图时,出现错误function populate_geometry_columns(unknown) is not unique
.我正在阅读的书使用了此书,但它给了我一个错误.对我来说可能是哪里出了问题?
When creating a View, I get the error function populate_geometry_columns(unknown) is not unique
. A book that I'm reading used this, but its giving me an error. What could have gone wrong for me?
查询:
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');
错误:
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
推荐答案
摘录自精美手册 :
简介
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'
字符串隐式转换为boolean
或oid
.我的大脑建议您使用oid
版本:
So there are two possible populate_geometry_columns
functions that could be called with one argument and neither has a TEXT argument. The error message is telling you that PostgreSQL doesn't know if it is supposed to implicitly cast your 'ch03.vw_paris_points'
string to a boolean
or an oid
. My human brain suggests that you want the oid
version:
SELECT populate_geometry_columns('ch03.vw_paris_points'::regclass);
-- add an explicit cast -------------------------------^^^^^^^^^^
但是PostgreSQL的软件头脑只是看到一个字符串而感到困惑. populate_geometry_columns
的单参数形式也许比您正在阅读的书新.
but PostgreSQL's software brain just sees a string and gets confused. Perhaps the single argument form of populate_geometry_columns
is newer than the book you're reading.
这篇关于PostGIS错误:无法选择最佳候选函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!