PostgreSQL:ST_GeomFromText(未知)不存在 [英] PostgreSQL: ST_GeomFromText(unknown) does not exist

查看:3012
本文介绍了PostgreSQL:ST_GeomFromText(未知)不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是问题所在,

我现在刚刚安装了PostgreSQL,并尝试构建geoloc数据库. 为此,我安装了PostGIS扩展程序和PostGIS_Topology.

I just installed PostgreSQL right now and try to build a geoloc database. For this, i installed the PostGIS extension and PostGIS_Topology.

在pgAdmin用户界面中,我可以看到我的模型,架构是"Geo",并且可以在下面的函数列表中看到可用的postGis函数(大约1000,请参见屏幕截图)

In my pgAdmin UI, i can see my model, my schema is "Geo" and I can see below, in the functions list, the postGis functions that are available (about 1000, see screenshot)

问题是,当我尝试在数据库中插入新记录时, 示例:

Problem is, when I try to insert a new record in the database, Example:

INSERT INTO "Geo".points(point, lat, lng) VALUES (ST_GeomFromText('POINT(42.555 32.222)'),'42.555','32.222');

我收到此错误:

ERROR : function st_geomfromtext(unknown) does not exist
SQL state : 42883
Character : 51

想法问题可能来自扩展名,但未启用,但似乎没问题,功能列表在db模型信息中可见...

Thought problem was coming from extension maybe not enabled, but seems like it is ok, list of functions is visible in the db model informations...

还尝试从数据库名称中调用该函数,但不起作用...

also tried to call the function from the db name, but not working...

..."Geo".ST_GeomFromText('...')...

另一个奇怪的事情是,当我尝试使用此命令时:

Another strange thing is that, when I try this command :

SELECT "Geo".ST_GeomFromText('POINT(42.222 32.555)')

有效...

这是屏幕截图:

我是PostgreSQL的新手,所以也许这是一个愚蠢的问题...但是我查看了堆栈和文档,却没有找到与我的问题相符的东西...

I'm NEW in PostgreSQL so maybe this is a stupid issue... But I looked through stack and the doc and don't find anything that match my problem...

感谢阅读/帮助

在测试完您的解决方案@mlinth之后,我仍然面临着同样的问题...

After testing your solution @mlinth I still face the same problem...

尝试时

INSERT INTO "Geo".points(point, lat, lng) 
SELECT "Geo".ST_GeomFromText('POINT(32.222 42.555)'),'42.555','32.222';
or
INSERT INTO "Geo".points(point, lat, lng) 
SELECT "Geo".ST_point(32.222,42.555 ),'42.555','32.222';

我遇到错误,SQL状态:42804字符51(带下划线的"Geo") 删除"Geo"会导致类似功能ST_GeomFromText(或ST_POINT)(未知)不存在"的错误.

I face Error , SQL state : 42804 character 51 ("Geo" is underlined) Removing "Geo" results in a error like "Function ST_GeomFromText (or ST_POINT) (unknown) does not exist"...

此功能似乎有效:

SELECT "Geo".ST_GeomFromText('POINT(42.222 35.555)')

返回

    st_geomfromtext "Geo".geometry
1 : "010100000023DBF97E6A1C4540D7A3703D0AC74140"

创建语句:

CREATE TABLE "Geo".points
(
  id serial NOT NULL,
  point point NOT NULL,
  lat text,
  lng text,
  CONSTRAINT points_pkey PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE "Geo".points
  OWNER TO postgres;

推荐答案

Point 不是PostGIS类型,而是本机的Postgresql类型.

Point is not a PostGIS type, it's a native Postgresql type.

我认为您需要将点列类型设置为几何形状,然后PostGIS函数才能正常工作.

I think you need to make your point column type geometry, then the PostGIS functions will work.

这篇关于PostgreSQL:ST_GeomFromText(未知)不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆