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
ea18b112
Commit
ea18b112
authored
Apr 28, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-12619 UNION creates excessive integer column types for integer literals
parent
a147eea6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
103 additions
and
34 deletions
+103
-34
mysql-test/r/gis.result
mysql-test/r/gis.result
+30
-30
mysql-test/r/metadata.result
mysql-test/r/metadata.result
+2
-2
mysql-test/r/union.result
mysql-test/r/union.result
+31
-1
mysql-test/suite/innodb_gis/r/create_spatial_index.result
mysql-test/suite/innodb_gis/r/create_spatial_index.result
+1
-1
mysql-test/t/union.test
mysql-test/t/union.test
+24
-0
sql/item.h
sql/item.h
+15
-0
No files found.
mysql-test/r/gis.result
View file @
ea18b112
...
...
@@ -4030,65 +4030,65 @@ DROP TABLE t1;
#
CREATE TABLE t1 (a GEOMETRY);
SELECT POINT(1,1) + 1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '+'
ERROR HY000: Illegal parameter data types geometry and int for operation '+'
SELECT POINT(1,1) - 1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '-'
ERROR HY000: Illegal parameter data types geometry and int for operation '-'
SELECT POINT(1,1) * 1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '*'
ERROR HY000: Illegal parameter data types geometry and int for operation '*'
SELECT POINT(1,1) / 1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '/'
ERROR HY000: Illegal parameter data types geometry and int for operation '/'
SELECT POINT(1,1) MOD 1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '%'
ERROR HY000: Illegal parameter data types geometry and int for operation '%'
SELECT 1 + POINT(1,1);
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '+'
ERROR HY000: Illegal parameter data types int and geometry for operation '+'
SELECT 1 - POINT(1,1);
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '-'
ERROR HY000: Illegal parameter data types int and geometry for operation '-'
SELECT 1 * POINT(1,1);
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '*'
ERROR HY000: Illegal parameter data types int and geometry for operation '*'
SELECT 1 / POINT(1,1);
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '/'
ERROR HY000: Illegal parameter data types int and geometry for operation '/'
SELECT 1 MOD POINT(1,1);
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '%'
ERROR HY000: Illegal parameter data types int and geometry for operation '%'
SELECT a + 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '+'
ERROR HY000: Illegal parameter data types geometry and int for operation '+'
SELECT a - 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '-'
ERROR HY000: Illegal parameter data types geometry and int for operation '-'
SELECT a * 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '*'
ERROR HY000: Illegal parameter data types geometry and int for operation '*'
SELECT a / 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '/'
ERROR HY000: Illegal parameter data types geometry and int for operation '/'
SELECT a MOD 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '%'
ERROR HY000: Illegal parameter data types geometry and int for operation '%'
SELECT 1 + a FROM t1;
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '+'
ERROR HY000: Illegal parameter data types int and geometry for operation '+'
SELECT 1 - a FROM t1;
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '-'
ERROR HY000: Illegal parameter data types int and geometry for operation '-'
SELECT 1 * a FROM t1;
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '*'
ERROR HY000: Illegal parameter data types int and geometry for operation '*'
SELECT 1 / a FROM t1;
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '/'
ERROR HY000: Illegal parameter data types int and geometry for operation '/'
SELECT 1 MOD a FROM t1;
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '%'
ERROR HY000: Illegal parameter data types int and geometry for operation '%'
SELECT COALESCE(a) + 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '+'
ERROR HY000: Illegal parameter data types geometry and int for operation '+'
SELECT COALESCE(a) - 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '-'
ERROR HY000: Illegal parameter data types geometry and int for operation '-'
SELECT COALESCE(a) * 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '*'
ERROR HY000: Illegal parameter data types geometry and int for operation '*'
SELECT COALESCE(a) / 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '/'
ERROR HY000: Illegal parameter data types geometry and int for operation '/'
SELECT COALESCE(a) MOD 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '%'
ERROR HY000: Illegal parameter data types geometry and int for operation '%'
SELECT 1 + COALESCE(a) FROM t1;
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '+'
ERROR HY000: Illegal parameter data types int and geometry for operation '+'
SELECT 1 - COALESCE(a) FROM t1;
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '-'
ERROR HY000: Illegal parameter data types int and geometry for operation '-'
SELECT 1 * COALESCE(a) FROM t1;
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '*'
ERROR HY000: Illegal parameter data types int and geometry for operation '*'
SELECT 1 / COALESCE(a) FROM t1;
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '/'
ERROR HY000: Illegal parameter data types int and geometry for operation '/'
SELECT 1 MOD COALESCE(a) FROM t1;
ERROR HY000: Illegal parameter data types
big
int and geometry for operation '%'
ERROR HY000: Illegal parameter data types int and geometry for operation '%'
DROP TABLE t1;
#
# MDEV-12514 Split Item_temporal_func::fix_length_and_dec()
...
...
mysql-test/r/metadata.result
View file @
ea18b112
...
...
@@ -76,12 +76,12 @@ def aaa @arg00 @arg00 8 20 1 Y 32768 0 63
1
select 1 union select 1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def 1 1
8 20
1 N 32769 0 63
def 1 1
3 11
1 N 32769 0 63
1
1
select * from (select 1 union select 1) aaa;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def aaa 1 1
8 20
1 N 32769 0 63
def aaa 1 1
3 11
1 N 32769 0 63
1
1
drop table t1;
...
...
mysql-test/r/union.result
View file @
ea18b112
...
...
@@ -852,7 +852,7 @@ select * from t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`1`
bigint(20
) NOT NULL DEFAULT 0
`1`
int(11
) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 select _latin1"test" union select _latin2"testt" ;
...
...
@@ -2178,3 +2178,33 @@ WHERE t1_2.b NOT IN ( SELECT 4 UNION ALL SELECT 5 );
a b a b
1 1 1 1
DROP TABLE t1;
#
# Start of 10.3 tests
#
#
# MDEV-12619 UNION creates excessive integer column types for integer literals
#
CREATE TABLE t1 AS SELECT 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`1` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 AS SELECT 1 UNION SELECT 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`1` int(11) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 AS SELECT * FROM (SELECT 1 UNION SELECT 1) AS t0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`1` int(11) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# End of 10.3 tests
#
mysql-test/suite/innodb_gis/r/create_spatial_index.result
View file @
ea18b112
...
...
@@ -1238,7 +1238,7 @@ Table Op Msg_type Msg_text
test.tab check status OK
DROP TABLE tab;
CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(c1 > 0) ) ENGINE=InnoDB;
ERROR HY000: Illegal parameter data types geometry and
big
int for operation '>'
ERROR HY000: Illegal parameter data types geometry and int for operation '>'
CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(CAST(c1 AS BINARY) > 0) ) ENGINE=InnoDB;
CREATE SPATIAL INDEX idx1 ON tab(c1) ;
SHOW CREATE TABLE tab;
...
...
mysql-test/t/union.test
View file @
ea18b112
...
...
@@ -1523,3 +1523,27 @@ SELECT * FROM t1 t1_1 LEFT JOIN t1 t1_2 ON ( t1_2.b = t1_1.a )
WHERE
t1_2
.
b
NOT
IN
(
SELECT
4
UNION
ALL
SELECT
5
);
DROP
TABLE
t1
;
--
echo
#
--
echo
# Start of 10.3 tests
--
echo
#
--
echo
#
--
echo
# MDEV-12619 UNION creates excessive integer column types for integer literals
--
echo
#
CREATE
TABLE
t1
AS
SELECT
1
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
CREATE
OR
REPLACE
TABLE
t1
AS
SELECT
1
UNION
SELECT
1
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
CREATE
OR
REPLACE
TABLE
t1
AS
SELECT
*
FROM
(
SELECT
1
UNION
SELECT
1
)
AS
t0
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# End of 10.3 tests
--
echo
#
sql/item.h
View file @
ea18b112
...
...
@@ -3207,6 +3207,17 @@ class Item_int :public Item_num
enum
Type
type
()
const
{
return
INT_ITEM
;
}
enum
Item_result
result_type
()
const
{
return
INT_RESULT
;
}
enum_field_types
field_type
()
const
{
return
MYSQL_TYPE_LONGLONG
;
}
const
Type_handler
*
type_handler
()
const
{
// The same condition is repeated in Item::create_tmp_field()
if
(
max_length
>
MY_INT32_NUM_DECIMAL_DIGITS
-
2
)
return
&
type_handler_longlong
;
return
&
type_handler_long
;
}
Field
*
create_tmp_field
(
bool
group
,
TABLE
*
table
)
{
return
tmp_table_field_from_field_type
(
table
);
}
Field
*
create_field_for_create_select
(
TABLE
*
table
)
{
return
tmp_table_field_from_field_type
(
table
);
}
longlong
val_int
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
value
;
}
double
val_real
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
(
double
)
value
;
}
my_decimal
*
val_decimal
(
my_decimal
*
);
...
...
@@ -3717,6 +3728,10 @@ class Item_return_int :public Item_int
unsigned_flag
=
1
;
}
enum_field_types
field_type
()
const
{
return
int_field_type
;
}
const
Type_handler
*
type_handler
()
const
{
return
Type_handler
::
get_handler_by_field_type
(
int_field_type
);
}
};
...
...
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