postgresql - PostgreSQL,Postgis 几何字段
问题描述
在我的表(坐标)中,我有 x、yz 坐标,我想创建一个包含该点的新 colmun。
id |x |y | z |
----------------------
1 |145 |9.6 |12.4 |
所以我运行以下命令:
ALTER TABLE coordinates ADD COLUMN point geometry;
UPDATE point SET = 'POINT(x y z)';
但我收到了这个错误:
<-- parse error at
解决方案
你的UPDATE
命令是错误的,怀疑你想要这样的东西:
(ST_MakePoint
可能不是您想要的构造函数,但我认为不POINT
存在)。
UPDATE coordinates SET point = ST_MakePoint(x,y,z);