Commit f0155f6a authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

ALTER TABLE didn't remember the exact

geometry type (POINT, LINESTRING, etc)
and changed all into "GEOMETRY".
parent 66d9143a
...@@ -355,3 +355,36 @@ first second w c o e d t i r ...@@ -355,3 +355,36 @@ first second w c o e d t i r
121 120 0 0 1 0 0 0 1 0 121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 0 1 0 121 121 1 1 0 1 0 0 1 0
DROP TABLE pt, ls, p, mpt, mls, mp, gc, geo; DROP TABLE pt, ls, p, mpt, mls, mp, gc, geo;
CREATE TABLE g1 (
pt point,
ln linestring,
pg polygon,
mpt multipoint,
mln multilinestring,
mpg multipolygon,
gc geometrycollection,
gm geometry
);
SHOW FIELDS FROM g1;
Field Type Collation Null Key Default Extra
pt point binary YES NULL
ln linestring binary YES NULL
pg polygon binary YES NULL
mpt multipoint binary YES NULL
mln multilinestring binary YES NULL
mpg multipolygon binary YES NULL
gc geometrycollection binary YES NULL
gm geometry binary YES NULL
ALTER TABLE g1 ADD fid INT NOT NULL;
SHOW FIELDS FROM g1;
Field Type Collation Null Key Default Extra
pt point binary YES NULL
ln linestring binary YES NULL
pg polygon binary YES NULL
mpt multipoint binary YES NULL
mln multilinestring binary YES NULL
mpg multipolygon binary YES NULL
gc geometrycollection binary YES NULL
gm geometry binary YES NULL
fid int(11) binary 0
DROP TABLE g1;
...@@ -121,3 +121,22 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r ...@@ -121,3 +121,22 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gc g1, gc g2 ORDER BY first, second; FROM gc g1, gc g2 ORDER BY first, second;
DROP TABLE pt, ls, p, mpt, mls, mp, gc, geo; DROP TABLE pt, ls, p, mpt, mls, mp, gc, geo;
#
# Check that ALTER TABLE doesn't loose geometry type
#
CREATE TABLE g1 (
pt point,
ln linestring,
pg polygon,
mpt multipoint,
mln multilinestring,
mpg multipolygon,
gc geometrycollection,
gm geometry
);
SHOW FIELDS FROM g1;
ALTER TABLE g1 ADD fid INT NOT NULL;
SHOW FIELDS FROM g1;
DROP TABLE g1;
...@@ -5475,4 +5475,8 @@ create_field::create_field(Field *old_field,Field *orig_field) ...@@ -5475,4 +5475,8 @@ create_field::create_field(Field *old_field,Field *orig_field)
def=new Item_string(pos,tmp.length(), charset); def=new Item_string(pos,tmp.length(), charset);
} }
} }
if (sql_type == FIELD_TYPE_GEOMETRY)
{
geom_type= ((Field_geom*)old_field)->geom_type;
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment