mysql column为对象,MySQL 5.7错误:无法从发送到GEOMETRY字段的数据中获取几何对象...

I have a column that is giving me a headache on MySQL Server 5.7.11.

It was of type POINT and I was able to change it to type GEOMETRY with no issues.

When I now try and change it from GEOMETRY to POINT I get the following error:

Error 1416: Cannot get geometry object from data you send to the GEOMETRY field SQL Statement: ALTER TABLEtable

CHANGE COLUMNcolumn_namecolumn_namePOINT NOT NULL;

I doesn't make sense to me why I could change it one way and not the other.

I have been having trouble with the POINT datatype, especially when I try and do select statements, it sometimes comes with the same error.

解决方案

"GEOMETRY can store geometry values of any type. The other single-value types (POINT, LINESTRING, and POLYGON) restrict their values to a particular geometry type."

So you can convert POINT to GEOMETRY - but because GEOMETRY can contain other geometry values you cannot go the other way.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值