当前位置: 动力学知识库 > 问答 > 编程问答 >

postgresql - how to pass geometric point as parameter in postgres function?

问题描述:

I have some function where I need to pass a point datatype .

somefunc("United States",Point(85.327892 27.703744))

But I am getting error with this.

ERROR: syntax error at or near "27.703744"

SQL state: 42601

Character: 1192

网友答案:

Maybe try add a comma between the function params?

somefunc("United States",Point(85.327892, 27.703744))
网友答案:

I sense some confusion between PostGIS and PostgreSQL's geometric data types. If you are using PostGIS, you need the ST_MakePoint function, which is perfect for parameters:

SELECT ST_SetSRID(ST_MakePoint($lon, $lat), 4326)) AS geom;
分享给朋友:
您可能感兴趣的文章:
随机阅读: