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
bd659be6
Commit
bd659be6
authored
Nov 05, 2009
by
Alexander Nozdrin
Browse files
Options
Browse Files
Download
Plain Diff
Auto-merge from mysql-5.1.
parents
a35e0131
c310a5c9
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
317 additions
and
29 deletions
+317
-29
mysql-test/r/innodb_mysql.result
mysql-test/r/innodb_mysql.result
+42
-0
mysql-test/r/locale.result
mysql-test/r/locale.result
+29
-0
mysql-test/r/partition_pruning.result
mysql-test/r/partition_pruning.result
+1
-2
mysql-test/r/range.result
mysql-test/r/range.result
+9
-0
mysql-test/r/sp.result
mysql-test/r/sp.result
+45
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+1
-2
mysql-test/t/innodb_mysql.test
mysql-test/t/innodb_mysql.test
+29
-0
mysql-test/t/locale.test
mysql-test/t/locale.test
+18
-0
mysql-test/t/range.test
mysql-test/t/range.test
+11
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+45
-1
sql/handler.h
sql/handler.h
+0
-1
sql/item.cc
sql/item.cc
+27
-7
sql/opt_range.cc
sql/opt_range.cc
+11
-0
sql/sql_locale.cc
sql/sql_locale.cc
+2
-2
sql/sql_yacc.yy
sql/sql_yacc.yy
+47
-14
No files found.
mysql-test/r/innodb_mysql.result
View file @
bd659be6
...
...
@@ -2209,4 +2209,46 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(PRIMARY) WHERE b=1 AND c=1 ORDER BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 128 Using where
DROP TABLE t1;
#
# Bug #47963: Wrong results when index is used
#
CREATE TABLE t1(
a VARCHAR(5) NOT NULL,
b VARCHAR(5) NOT NULL,
c DATETIME NOT NULL,
KEY (c)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES('TEST', 'TEST', '2009-10-09 00:00:00');
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00';
a b c
TEST TEST 2009-10-09 00:00:00
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00.0';
a b c
TEST TEST 2009-10-09 00:00:00
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00';
a b c
TEST TEST 2009-10-09 00:00:00
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00.0';
a b c
TEST TEST 2009-10-09 00:00:00
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.000' AND c <= '2009-10-09 00:00:00.000';
a b c
TEST TEST 2009-10-09 00:00:00
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.00' AND c <= '2009-10-09 00:00:00.001';
a b c
TEST TEST 2009-10-09 00:00:00
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
a b c
EXPLAIN SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DROP TABLE t1;
End of 5.1 tests
mysql-test/r/locale.result
0 → 100644
View file @
bd659be6
DROP TABLE IF EXISTS t1;
Start of 5.4 tests
#
# Bug#43207 wrong LC_TIME names for romanian locale
#
SET NAMES utf8;
SET lc_time_names=ro_RO;
SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
DATE_FORMAT('2001-01-01', '%w %a %W')
1 Lu Luni
SELECT DATE_FORMAT('2001-01-02', '%w %a %W');
DATE_FORMAT('2001-01-02', '%w %a %W')
2 Ma Marţi
SELECT DATE_FORMAT('2001-01-03', '%w %a %W');
DATE_FORMAT('2001-01-03', '%w %a %W')
3 Mi Miercuri
SELECT DATE_FORMAT('2001-01-04', '%w %a %W');
DATE_FORMAT('2001-01-04', '%w %a %W')
4 Jo Joi
SELECT DATE_FORMAT('2001-01-05', '%w %a %W');
DATE_FORMAT('2001-01-05', '%w %a %W')
5 Vi Vineri
SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
DATE_FORMAT('2001-01-06', '%w %a %W')
6 Sâ Sâmbătă
SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
DATE_FORMAT('2001-01-07', '%w %a %W')
0 Du Duminică
End of 5.4 tests
mysql-test/r/partition_pruning.result
View file @
bd659be6
...
...
@@ -1272,10 +1272,9 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (2, NULL);
# test with an invalid date, which lead to item->null_value is set.
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-99' AS DATETIME);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE
t1 p20090401 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE
NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Warning 1292 Incorrect datetime value: '2009-04-99'
Warning 1292 Incorrect datetime value: '2009-04-99'
DROP TABLE t1;
CREATE TABLE t1
(a INT NOT NULL AUTO_INCREMENT,
...
...
mysql-test/r/range.result
View file @
bd659be6
...
...
@@ -1398,3 +1398,12 @@ a < 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range a a 5 NULL 8 Using where; Using index
DROP TABLE t1, t2, t3;
#
# Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
#
CREATE TABLE t1(a INT, KEY(a));
INSERT INTO t1 VALUES (1), (NULL);
SELECT * FROM t1 WHERE a <> NULL and (a <> NULL or a <= NULL);
a
DROP TABLE t1;
End of 5.1 tests
mysql-test/r/sp.result
View file @
bd659be6
...
...
@@ -6979,6 +6979,51 @@ CALL p1;
ERROR 42S22: Unknown column 'A.b' in 'IN/ALL/ANY subquery'
DROP PROCEDURE p1;
DROP TABLE t1, t2;
#
# Bug47627 SET @@{global.session}.local_variable in stored routine causes crash
#
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
DROP PROCEDURE IF EXISTS p3;
CREATE PROCEDURE p1()
BEGIN
DECLARE v INT DEFAULT 0;
SET @@session.v= 10;
END//
ERROR HY000: Unknown system variable 'v'
CREATE PROCEDURE p2()
BEGIN
DECLARE v INT DEFAULT 0;
SET v= 10;
END//
call p2()//
CREATE PROCEDURE p3()
BEGIN
DECLARE v INT DEFAULT 0;
SELECT @@session.v;
END//
ERROR HY000: Unknown system variable 'v'
CREATE PROCEDURE p4()
BEGIN
DECLARE v INT DEFAULT 0;
SET @@global.v= 10;
END//
ERROR HY000: Unknown system variable 'v'
CREATE PROCEDURE p5()
BEGIN
DECLARE v INT DEFAULT 0;
SET @@global.query_cache_size= 0;
SET @@session.identity= 1;
SELECT @@session.identity;
SELECT @@global.query_cache_size;
END//
CALL p5();
@@session.identity
1
@@global.query_cache_size
0
DROP PROCEDURE p2;
DROP PROCEDURE p5;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------
mysql-test/r/subselect.result
View file @
bd659be6
...
...
@@ -4403,8 +4403,7 @@ FROM t1
WHERE a = 230;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY st1 index NULL a 5 NULL 2 Using index
2 DEPENDENT SUBQUERY st2 index b b 5 NULL 2 Using where; Using index; Using join buffer
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
FROM t1
WHERE a = 230;
...
...
mysql-test/t/innodb_mysql.test
View file @
bd659be6
...
...
@@ -461,4 +461,33 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(PRIMARY) WHERE b=1 AND c=1 ORDER BY a;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug #47963: Wrong results when index is used
--
echo
#
CREATE
TABLE
t1
(
a
VARCHAR
(
5
)
NOT
NULL
,
b
VARCHAR
(
5
)
NOT
NULL
,
c
DATETIME
NOT
NULL
,
KEY
(
c
)
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
'TEST'
,
'TEST'
,
'2009-10-09 00:00:00'
);
SELECT
*
FROM
t1
WHERE
a
=
'TEST'
AND
c
>=
'2009-10-09 00:00:00'
AND
c
<=
'2009-10-09 00:00:00'
;
SELECT
*
FROM
t1
WHERE
a
=
'TEST'
AND
c
>=
'2009-10-09 00:00:00.0'
AND
c
<=
'2009-10-09 00:00:00.0'
;
SELECT
*
FROM
t1
WHERE
a
=
'TEST'
AND
c
>=
'2009-10-09 00:00:00.0'
AND
c
<=
'2009-10-09 00:00:00'
;
SELECT
*
FROM
t1
WHERE
a
=
'TEST'
AND
c
>=
'2009-10-09 00:00:00'
AND
c
<=
'2009-10-09 00:00:00.0'
;
SELECT
*
FROM
t1
WHERE
a
=
'TEST'
AND
c
>=
'2009-10-09 00:00:00.000'
AND
c
<=
'2009-10-09 00:00:00.000'
;
SELECT
*
FROM
t1
WHERE
a
=
'TEST'
AND
c
>=
'2009-10-09 00:00:00.00'
AND
c
<=
'2009-10-09 00:00:00.001'
;
SELECT
*
FROM
t1
WHERE
a
=
'TEST'
AND
c
>=
'2009-10-09 00:00:00.001'
AND
c
<=
'2009-10-09 00:00:00.00'
;
EXPLAIN
SELECT
*
FROM
t1
WHERE
a
=
'TEST'
AND
c
>=
'2009-10-09 00:00:00.001'
AND
c
<=
'2009-10-09 00:00:00.00'
;
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
mysql-test/t/locale.test
0 → 100644
View file @
bd659be6
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
--
echo
Start
of
5.4
tests
--
echo
#
--
echo
# Bug#43207 wrong LC_TIME names for romanian locale
--
echo
#
SET
NAMES
utf8
;
SET
lc_time_names
=
ro_RO
;
SELECT
DATE_FORMAT
(
'2001-01-01'
,
'%w %a %W'
);
SELECT
DATE_FORMAT
(
'2001-01-02'
,
'%w %a %W'
);
SELECT
DATE_FORMAT
(
'2001-01-03'
,
'%w %a %W'
);
SELECT
DATE_FORMAT
(
'2001-01-04'
,
'%w %a %W'
);
SELECT
DATE_FORMAT
(
'2001-01-05'
,
'%w %a %W'
);
SELECT
DATE_FORMAT
(
'2001-01-06'
,
'%w %a %W'
);
SELECT
DATE_FORMAT
(
'2001-01-07'
,
'%w %a %W'
);
--
echo
End
of
5.4
tests
mysql-test/t/range.test
View file @
bd659be6
...
...
@@ -1171,3 +1171,14 @@ a < 5 OR
a
<
10
;
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
#
--
echo
# Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
KEY
(
a
));
INSERT
INTO
t1
VALUES
(
1
),
(
NULL
);
SELECT
*
FROM
t1
WHERE
a
<>
NULL
and
(
a
<>
NULL
or
a
<=
NULL
);
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
mysql-test/t/sp.test
View file @
bd659be6
...
...
@@ -8263,7 +8263,51 @@ CALL p1;
DROP
PROCEDURE
p1
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# Bug47627 SET @@{global.session}.local_variable in stored routine causes crash
--
echo
#
--
disable_warnings
DROP
PROCEDURE
IF
EXISTS
p1
;
DROP
PROCEDURE
IF
EXISTS
p2
;
DROP
PROCEDURE
IF
EXISTS
p3
;
--
enable_warnings
delimiter
//;
--
error
ER_UNKNOWN_SYSTEM_VARIABLE
CREATE
PROCEDURE
p1
()
BEGIN
DECLARE
v
INT
DEFAULT
0
;
SET
@@
session
.
v
=
10
;
END
//
CREATE
PROCEDURE
p2
()
BEGIN
DECLARE
v
INT
DEFAULT
0
;
SET
v
=
10
;
END
//
call
p2
()
//
--
error
ER_UNKNOWN_SYSTEM_VARIABLE
CREATE
PROCEDURE
p3
()
BEGIN
DECLARE
v
INT
DEFAULT
0
;
SELECT
@@
session
.
v
;
END
//
--
error
ER_UNKNOWN_SYSTEM_VARIABLE
CREATE
PROCEDURE
p4
()
BEGIN
DECLARE
v
INT
DEFAULT
0
;
SET
@@
global
.
v
=
10
;
END
//
CREATE
PROCEDURE
p5
()
BEGIN
DECLARE
v
INT
DEFAULT
0
;
SET
@@
global
.
query_cache_size
=
0
;
SET
@@
session
.
identity
=
1
;
SELECT
@@
session
.
identity
;
SELECT
@@
global
.
query_cache_size
;
END
//
delimiter
;
//
CALL
p5
();
DROP
PROCEDURE
p2
;
DROP
PROCEDURE
p5
;
--
echo
# ------------------------------------------------------------------
--
echo
# -- End of 5.1 tests
--
echo
# ------------------------------------------------------------------
sql/handler.h
View file @
bd659be6
...
...
@@ -398,7 +398,6 @@ struct xid_t {
my_xid
get_my_xid
()
{
return
gtrid_length
==
MYSQL_XID_GTRID_LEN
&&
bqual_length
==
0
&&
!
memcmp
(
data
+
MYSQL_XID_PREFIX_LEN
,
&
server_id
,
sizeof
(
server_id
))
&&
!
memcmp
(
data
,
MYSQL_XID_PREFIX
,
MYSQL_XID_PREFIX_LEN
)
?
quick_get_my_xid
()
:
0
;
}
...
...
sql/item.cc
View file @
bd659be6
...
...
@@ -6900,17 +6900,37 @@ int stored_field_cmp_to_item(Field *field, Item *item)
/*
If comparing DATE with DATETIME, append the time-part to the DATE.
So that the strings are equally formatted.
A DATE converted to string is 10
characters, and a DATETIME converted
to string is 19
characters.
A DATE converted to string is 10
(MAX_DATE_WIDTH) characters,
and a DATETIME converted to string is 19 (MAX_DATETIME_WIDTH)
characters.
*/
field_type
=
field
->
type
();
uint32
item_length
=
item_result
->
length
();
if
(
field_type
==
MYSQL_TYPE_DATE
&&
item_
result
->
length
()
==
19
)
item_
length
==
MAX_DATETIME_WIDTH
)
field_tmp
.
append
(
" 00:00:00"
);
else
if
(
field_type
==
MYSQL_TYPE_DATETIME
&&
item_result
->
length
()
==
10
)
item_result
->
append
(
" 00:00:00"
);
else
if
(
field_type
==
MYSQL_TYPE_DATETIME
)
{
if
(
item_length
==
MAX_DATE_WIDTH
)
item_result
->
append
(
" 00:00:00"
);
else
if
(
item_length
>
MAX_DATETIME_WIDTH
)
{
/*
We don't store microsecond part of DATETIME in field
but item_result contains it. As we compare DATETIMEs as strings
we must trim trailing 0's in item_result's microsecond part
to ensure "YYYY-MM-DD HH:MM:SS" == "YYYY-MM-DD HH:MM:SS.0000"
*/
char
*
end
=
(
char
*
)
item_result
->
ptr
()
+
item_length
-
1
;
/* Trim trailing 0's */
while
(
*
end
==
'0'
)
end
--
;
/* Trim '.' if no microseconds */
if
(
*
end
==
'.'
)
end
--
;
DBUG_ASSERT
(
end
-
item_result
->
ptr
()
+
1
>=
MAX_DATETIME_WIDTH
);
item_result
->
length
(
end
-
item_result
->
ptr
()
+
1
);
}
}
return
stringcmp
(
&
field_tmp
,
item_result
);
}
if
(
res_type
==
INT_RESULT
)
...
...
sql/opt_range.cc
View file @
bd659be6
...
...
@@ -5891,6 +5891,17 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
goto
end
;
}
field
->
table
->
in_use
->
variables
.
sql_mode
=
orig_sql_mode
;
/*
Any sargable predicate except "<=>" involving NULL as a constant is always
FALSE
*/
if
(
type
!=
Item_func
::
EQUAL_FUNC
&&
field
->
is_real_null
())
{
tree
=
&
null_element
;
goto
end
;
}
str
=
(
uchar
*
)
alloc_root
(
alloc
,
key_part
->
store_length
+
1
);
if
(
!
str
)
goto
end
;
...
...
sql/sql_locale.cc
View file @
bd659be6
...
...
@@ -1309,9 +1309,9 @@ static const char *my_locale_month_names_ro_RO[13] =
static
const
char
*
my_locale_ab_month_names_ro_RO
[
13
]
=
{
"ian"
,
"feb"
,
"mar"
,
"apr"
,
"mai"
,
"iun"
,
"iul"
,
"aug"
,
"sep"
,
"oct"
,
"nov"
,
"dec"
,
NullS
};
static
const
char
*
my_locale_day_names_ro_RO
[
8
]
=
{
"Luni"
,
"Marţi"
,
"Miercuri"
,
"Joi"
,
"Vineri"
,
"S
îmbĂtĂ"
,
"DuminicĂ
"
,
NullS
};
{
"Luni"
,
"Marţi"
,
"Miercuri"
,
"Joi"
,
"Vineri"
,
"S
âmbătă"
,
"Duminică
"
,
NullS
};
static
const
char
*
my_locale_ab_day_names_ro_RO
[
8
]
=
{
"Lu"
,
"Ma"
,
"Mi"
,
"Jo"
,
"Vi"
,
"S
î
"
,
"Du"
,
NullS
};
{
"Lu"
,
"Ma"
,
"Mi"
,
"Jo"
,
"Vi"
,
"S
â
"
,
"Du"
,
NullS
};
static
TYPELIB
my_locale_typelib_month_names_ro_RO
=
{
array_elements
(
my_locale_month_names_ro_RO
)
-
1
,
""
,
my_locale_month_names_ro_RO
,
NULL
};
static
TYPELIB
my_locale_typelib_ab_month_names_ro_RO
=
...
...
sql/sql_yacc.yy
View file @
bd659be6
...
...
@@ -11783,8 +11783,17 @@ option_type:
;
option_type2:
/* empty */ { $$= OPT_DEFAULT; }
| ONE_SHOT_SYM { Lex->one_shot_set= 1; $$= OPT_SESSION; }
/* empty */
{
$$= OPT_DEFAULT;
Lex->option_type= OPT_DEFAULT;
}
| ONE_SHOT_SYM
{
Lex->one_shot_set= 1;
$$= OPT_SESSION;
Lex->option_type= OPT_SESSION;
}
;
opt_var_type:
...
...
@@ -11795,10 +11804,26 @@ opt_var_type:
;
opt_var_ident_type:
/* empty */ { $$=OPT_DEFAULT; }
| GLOBAL_SYM '.' { $$=OPT_GLOBAL; }
| LOCAL_SYM '.' { $$=OPT_SESSION; }
| SESSION_SYM '.' { $$=OPT_SESSION; }
/* empty */
{
$$=OPT_DEFAULT;
Lex->option_type= OPT_DEFAULT;
}
| GLOBAL_SYM '.'
{
$$=OPT_GLOBAL;
Lex->option_type= OPT_GLOBAL;
}
| LOCAL_SYM '.'
{
$$=OPT_SESSION;
Lex->option_type= OPT_SESSION;
}
| SESSION_SYM '.'
{
$$=OPT_SESSION;
Lex->option_type= OPT_SESSION;
}
;
ext_option_value:
...
...
@@ -12038,8 +12063,22 @@ internal_variable_name:
sp_pcontext *spc= lex->spcont;
sp_variable_t *spv;
/* We have to lookup here since local vars can shadow sysvars */
if (!spc || !(spv = spc->find_variable(&$1)))
/*
We have to lookup here since local vars can shadow sysvars.
We also have to inspect the option_type first since the variable
identifier might have been prefixed with @@session or @@global
prefixes. Without this check we would wrongly identify them
as SP local variables.
*/
if (lex->option_type == OPT_DEFAULT && spc &&
(spv= spc->find_variable(&$1)))
{
/* An SP local variable */
$$.var= NULL;
$$.base_name= $1;
}
else
{
/* Not an SP local variable */
sys_var *tmp=find_sys_var(thd, $1.str, $1.length);
...
...
@@ -12056,12 +12095,6 @@ internal_variable_name:
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
}
}
else
{
/* An SP local variable */
$$.var= NULL;
$$.base_name= $1;
}
}
| ident '.' ident
{
...
...
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