【发布时间】:2020-12-28 19:40:23
【问题描述】:
我在 mariaDB 上创建了一个具有以下定义的表。注意经度和纬度字段。
Create Table geo_data (
geo_data_id int NOT NULL AUTO_INCREMENT,
place_id int NOT NULL,
longitude DOUBLE(18,18) SIGNED,
latitude DOUBLE(18,18) SIGNED,
Primary Key (geo_data_id),
Foreign Key (place_id) References place (place_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
当我尝试使用
将数据插入geo_data 表时
Insert into geo_data (place_id, longitude, latitude) Values (1, 1.2, 3.4);
我收到以下错误消息:
Error: ER_WARN_DATA_OUT_OF_RANGE: Out of range value for column 'longitude' at row 1
我想我在这里遗漏了一些东西,因为我不相信1.2 会以任何方式超出Double(18,18) 的范围。那么这里到底发生了什么?
【问题讨论】:
标签: sql mariadb sql-insert create-table