【发布时间】:2014-02-19 17:25:02
【问题描述】:
我有这个(非工作)查询:
"INSERT INTO notes (
lat,
lng,
point)
VALUES (
:lat,
:lng,
ST_GeometryFromText('POINT(:lat :lng)'))"
我正在针对这张桌子运行:
CREATE TABLE notes
(
id serial NOT NULL,
lat real NOT NULL,
lng real NOT NULL,
point point NOT NULL,
CONSTRAINT notes_pkey PRIMARY KEY (id )
)
查询是用 PDO (php) 准备的,但这不是我认为的重点。我得到的结果是一个异常声称:
SQLSTATE[42804]: Datatype mismatch: 7 ERROR: column "point" is of type point but expression is of type geometry
LINE 8: $8, $9, $10, $11, $12, ST_GeometryFromText('POINT(:...
^
HINT: You will need to rewrite or cast the expression.
如何按照建议转换表达式?
【问题讨论】:
标签: php postgresql pdo postgis