1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
point_data POINT NOT NULL,
PRIMARY KEY (id),
KEY idx_point_data(point_data)
) ENGINE=MyISAM;
INSERT t1 (point_data) VALUES
(GeomFromText('Point(37.0248492 23.8512726)')),
(GeomFromText('Point(38.0248492 23.8512726)'));
SELECT id FROM t1
WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
id
2
DROP TABLE t1;
create table t1 (p point default "qwer");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
create table t1 (p point default 0);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
create table t1 (p point not null default st_geometryfromtext('point 0)'));
ERROR 42000: Invalid default value for 'p'
create table t1 (p point not null default st_geometryfromtext('point(0 0)'));
insert into t1 values(default);
select st_astext(p) from t1;
st_astext(p)
POINT(0 0)
drop table t1;
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
set timestamp=10;
insert into t1 values(default);
ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1
drop table t1;
SET timestamp=default;
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
set timestamp=10;
alter table t1 add column i int;
ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1
drop table t1;
SET timestamp=default;
|