Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e9a692fe
Commit
e9a692fe
authored
Jun 21, 2019
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-19819 ALTER from POINT to LINESTRING erroneously preserves POINT values
parent
8b576616
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
11 deletions
+56
-11
mysql-test/main/gis.result
mysql-test/main/gis.result
+16
-0
mysql-test/main/gis.test
mysql-test/main/gis.test
+19
-0
mysql-test/suite/innodb_gis/r/alter_spatial_index.result
mysql-test/suite/innodb_gis/r/alter_spatial_index.result
+3
-7
mysql-test/suite/innodb_gis/t/alter_spatial_index.test
mysql-test/suite/innodb_gis/t/alter_spatial_index.test
+1
-2
sql/field.h
sql/field.h
+17
-2
No files found.
mysql-test/main/gis.result
View file @
e9a692fe
...
...
@@ -5019,5 +5019,21 @@ ERROR HY000: Illegal parameter data types int and geometry for operation 'in'
SELECT (1,(0,0)) IN ((1,(POINT(1,1),0)),(0,(0,0)));
ERROR HY000: Illegal parameter data types int and geometry for operation 'in'
#
# MDEV-19819 ALTER from POINT to LINESTRING erroneously preserves POINT values
#
CREATE TABLE t1 (a POINT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (Point(0,0));
ALTER TABLE t1 MODIFY a LINESTRING;
ERROR 22007: Incorrect LINESTRING value: 'POINT' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a LINESTRING);
CREATE TABLE t2 (a POINT);
INSERT INTO t2 VALUES (POINT(0,0));
INSERT INTO t1 SELECT * FROM t2;
ERROR 22007: Incorrect LINESTRING value: 'POINT' for column `test`.`t1`.`a` at row 1
SELECT AsText(a) FROM t1;
AsText(a)
DROP TABLE t1, t2;
#
# End of 10.4 tests
#
mysql-test/main/gis.test
View file @
e9a692fe
...
...
@@ -3094,6 +3094,25 @@ SELECT (1,0) IN ((POINT(1,1),0),(0,0));
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT
(
1
,(
0
,
0
))
IN
((
1
,(
POINT
(
1
,
1
),
0
)),(
0
,(
0
,
0
)));
--
echo
#
--
echo
# MDEV-19819 ALTER from POINT to LINESTRING erroneously preserves POINT values
--
echo
#
CREATE
TABLE
t1
(
a
POINT
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
Point
(
0
,
0
));
--
error
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
ALTER
TABLE
t1
MODIFY
a
LINESTRING
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
LINESTRING
);
CREATE
TABLE
t2
(
a
POINT
);
INSERT
INTO
t2
VALUES
(
POINT
(
0
,
0
));
--
error
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
INSERT
INTO
t1
SELECT
*
FROM
t2
;
SELECT
AsText
(
a
)
FROM
t1
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# End of 10.4 tests
--
echo
#
mysql-test/suite/innodb_gis/r/alter_spatial_index.result
View file @
e9a692fe
...
...
@@ -485,8 +485,7 @@ ALTER TABLE tab MODIFY COLUMN c2 GEOMETRY NOT NULL;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE tab MODIFY COLUMN c3 POLYGON NOT NULL;
affected rows: 10
info: Records: 10 Duplicates: 0 Warnings: 0
ERROR 22007: Incorrect POLYGON value: 'LINESTRING' for column `test`.`tab`.`c3` at row 1
ALTER TABLE tab add COLUMN c7 POINT NOT NULL;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
...
...
@@ -528,7 +527,7 @@ Table Create Table
tab CREATE TABLE `tab` (
`c1` int(11) NOT NULL,
`c2` geometry NOT NULL,
`c3`
polygon
NOT NULL,
`c3`
linestring
NOT NULL,
`c4` polygon NOT NULL,
`c5` geometry NOT NULL,
`c7` point NOT NULL,
...
...
@@ -565,7 +564,7 @@ Table Create Table
tab CREATE TABLE `tab` (
`c1` int(11) NOT NULL,
`c2` geometry NOT NULL,
`c3`
polygon
NOT NULL,
`c3`
linestring
NOT NULL,
`c4` geometry NOT NULL,
`c5` geometry NOT NULL,
`c7` point NOT NULL,
...
...
@@ -614,9 +613,6 @@ SET @g2 = ST_GeomFromText('LINESTRING(1 1,2 2,3 3)');
ALTER TABLE tab MODIFY COLUMN c2 POINT NOT NULL;
affected rows: 8
info: Records: 8 Duplicates: 0 Warnings: 0
ALTER TABLE tab MODIFY COLUMN c3 LINESTRING NOT NULL;
affected rows: 8
info: Records: 8 Duplicates: 0 Warnings: 0
ALTER TABLE tab MODIFY COLUMN c4 POLYGON NOT NULL;
affected rows: 8
info: Records: 8 Duplicates: 0 Warnings: 0
...
...
mysql-test/suite/innodb_gis/t/alter_spatial_index.test
View file @
e9a692fe
...
...
@@ -476,6 +476,7 @@ ALTER TABLE tab ADD INDEX idx6(c4(10)) USING BTREE;
ALTER
TABLE
tab
MODIFY
COLUMN
c2
GEOMETRY
NOT
NULL
;
--
error
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
ALTER
TABLE
tab
MODIFY
COLUMN
c3
POLYGON
NOT
NULL
;
ALTER
TABLE
tab
add
COLUMN
c7
POINT
NOT
NULL
;
...
...
@@ -552,8 +553,6 @@ SET @g2 = ST_GeomFromText('LINESTRING(1 1,2 2,3 3)');
--
enable_info
ALTER
TABLE
tab
MODIFY
COLUMN
c2
POINT
NOT
NULL
;
ALTER
TABLE
tab
MODIFY
COLUMN
c3
LINESTRING
NOT
NULL
;
ALTER
TABLE
tab
MODIFY
COLUMN
c4
POLYGON
NOT
NULL
;
--
disable_info
...
...
sql/field.h
View file @
e9a692fe
...
...
@@ -1528,7 +1528,7 @@ class Field: public Value_source
{
return
field_length
/
charset
()
->
mbmaxlen
;
}
virtual
geometry_type
get_geometry_type
()
virtual
geometry_type
get_geometry_type
()
const
{
/* shouldn't get here. */
DBUG_ASSERT
(
0
);
...
...
@@ -4138,6 +4138,21 @@ class Field_geom :public Field_blob {
const
Item
*
item
,
bool
is_eq_func
)
const
;
void
sql_type
(
String
&
str
)
const
;
Copy_func
*
get_copy_func
(
const
Field
*
from
)
const
{
if
(
type_handler
()
==
from
->
type_handler
()
&&
(
geom_type
==
GEOM_GEOMETRY
||
geom_type
==
static_cast
<
const
Field_geom
*>
(
from
)
->
geom_type
))
return
get_identical_copy_func
();
return
do_conv_blob
;
}
bool
memcpy_field_possible
(
const
Field
*
from
)
const
{
return
type_handler
()
==
from
->
type_handler
()
&&
(
geom_type
==
GEOM_GEOMETRY
||
geom_type
==
static_cast
<
const
Field_geom
*>
(
from
)
->
geom_type
)
&&
!
table
->
copy_blobs
;
}
uint
is_equal
(
Create_field
*
new_field
);
int
store
(
const
char
*
to
,
size_t
length
,
CHARSET_INFO
*
charset
);
int
store
(
double
nr
);
...
...
@@ -4161,7 +4176,7 @@ class Field_geom :public Field_blob {
bool
load_data_set_null
(
THD
*
thd
);
bool
load_data_set_no_data
(
THD
*
thd
,
bool
fixed_format
);
geometry_type
get_geometry_type
()
{
return
geom_type
;
};
geometry_type
get_geometry_type
()
const
{
return
geom_type
;
};
static
geometry_type
geometry_type_merge
(
geometry_type
,
geometry_type
);
uint
get_srid
()
{
return
srid
;
}
void
print_key_value
(
String
*
out
,
uint32
length
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment