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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
a0499f30
Commit
a0499f30
authored
Mar 14, 2007
by
gkodinov/kgeorge@magare.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-5.1-opt
into magare.gmz:/home/kgeorge/mysql/autopush/B26794-merge-5.1-opt
parents
19f479d6
2fd1bd92
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
173 additions
and
8 deletions
+173
-8
mysql-test/r/alter_table.result
mysql-test/r/alter_table.result
+4
-4
mysql-test/r/order_by.result
mysql-test/r/order_by.result
+22
-0
mysql-test/r/select.result
mysql-test/r/select.result
+38
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+13
-0
mysql-test/t/order_by.test
mysql-test/t/order_by.test
+15
-0
mysql-test/t/select.test
mysql-test/t/select.test
+47
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+12
-0
sql/filesort.cc
sql/filesort.cc
+4
-1
sql/item.cc
sql/item.cc
+13
-2
sql/item.h
sql/item.h
+5
-1
No files found.
mysql-test/r/alter_table.result
View file @
a0499f30
...
...
@@ -886,7 +886,7 @@ ALTER TABLE t1 ADD b GEOMETRY NOT NULL, ADD SPATIAL INDEX(b);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(500)
DEFAULT
NULL,
`a` varchar(500)
default
NULL,
`b` geometry NOT NULL,
SPATIAL KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
...
...
@@ -894,7 +894,7 @@ ALTER TABLE t1 ADD KEY(b(50));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(500)
DEFAULT
NULL,
`a` varchar(500)
default
NULL,
`b` geometry NOT NULL,
SPATIAL KEY `b` (`b`),
KEY `b_2` (`b`(50))
...
...
@@ -903,9 +903,9 @@ ALTER TABLE t1 ADD c POINT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(500)
DEFAULT
NULL,
`a` varchar(500)
default
NULL,
`b` geometry NOT NULL,
`c` point
DEFAULT
NULL,
`c` point
default
NULL,
SPATIAL KEY `b` (`b`),
KEY `b_2` (`b`(50))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
...
...
mysql-test/r/order_by.result
View file @
a0499f30
...
...
@@ -958,6 +958,28 @@ a ratio
19 1.3333
9 2.6667
drop table t1;
CREATE TABLE t1 (a INT UNSIGNED NOT NULL, b TIME);
INSERT INTO t1 (a) VALUES (100000), (0), (100), (1000000),(10000), (1000), (10);
UPDATE t1 SET b = SEC_TO_TIME(a);
SELECT a, b FROM t1 ORDER BY b DESC;
a b
1000000 277:46:40
100000 27:46:40
10000 02:46:40
1000 00:16:40
100 00:01:40
10 00:00:10
0 00:00:00
SELECT a, b FROM t1 ORDER BY SEC_TO_TIME(a) DESC;
a b
1000000 277:46:40
100000 27:46:40
10000 02:46:40
1000 00:16:40
100 00:01:40
10 00:00:10
0 00:00:00
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), UNIQUE KEY b (b));
INSERT INTO t1 VALUES (1,1),(2,2);
CREATE TABLE t2 (a INT, b INT, KEY a (a,b));
...
...
mysql-test/r/select.result
View file @
a0499f30
...
...
@@ -3933,4 +3933,42 @@ cc cc 7
aa aa 2
aa aa 2
DROP TABLE t1,t2;
CREATE TABLE t1 (
access_id int NOT NULL default '0',
name varchar(20) default NULL,
rank int NOT NULL default '0',
KEY idx (access_id)
);
CREATE TABLE t2 (
faq_group_id int NOT NULL default '0',
faq_id int NOT NULL default '0',
access_id int default NULL,
UNIQUE KEY idx1 (faq_id),
KEY idx2 (faq_group_id,faq_id)
);
INSERT INTO t1 VALUES
(1,'Everyone',2),(2,'Help',3),(3,'Technical Support',1),(4,'Chat User',4);
INSERT INTO t2 VALUES
(261,265,1),(490,494,1);
SELECT t2.faq_id
FROM t1 INNER JOIN t2 IGNORE INDEX (idx1)
ON (t1.access_id = t2.access_id)
LEFT JOIN t2 t
ON (t.faq_group_id = t2.faq_group_id AND
find_in_set(t.access_id, '1,4') < find_in_set(t2.access_id, '1,4'))
WHERE
t2.access_id IN (1,4) AND t.access_id IS NULL AND t2.faq_id in (265);
faq_id
265
SELECT t2.faq_id
FROM t1 INNER JOIN t2
ON (t1.access_id = t2.access_id)
LEFT JOIN t2 t
ON (t.faq_group_id = t2.faq_group_id AND
find_in_set(t.access_id, '1,4') < find_in_set(t2.access_id, '1,4'))
WHERE
t2.access_id IN (1,4) AND t.access_id IS NULL AND t2.faq_id in (265);
faq_id
265
DROP TABLE t1,t2;
End of 5.0 tests
mysql-test/r/subselect.result
View file @
a0499f30
...
...
@@ -3873,3 +3873,16 @@ id_1
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t1xt2;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (3), (1), (2);
SELECT 'this is ' 'a test.' AS col1, a AS col2 FROM t1;
col1 col2
this is a test. 3
this is a test. 1
this is a test. 2
SELECT * FROM (SELECT 'this is ' 'a test.' AS col1, a AS t2 FROM t1) t;
col1 t2
this is a test. 3
this is a test. 1
this is a test. 2
DROP table t1;
mysql-test/t/order_by.test
View file @
a0499f30
...
...
@@ -678,6 +678,21 @@ insert into t1 values (1,2,3), (9,8,3), (19,4,3), (1,4,9);
select
a
,(
sum
(
b
)
/
sum
(
c
))
as
ratio
from
t1
group
by
a
order
by
sum
(
b
)
/
sum
(
c
)
asc
;
drop
table
t1
;
#
# Bug#26672: Incorrect SEC_TO_TIME() casting in ORDER BY
#
CREATE
TABLE
t1
(
a
INT
UNSIGNED
NOT
NULL
,
b
TIME
);
INSERT
INTO
t1
(
a
)
VALUES
(
100000
),
(
0
),
(
100
),
(
1000000
),(
10000
),
(
1000
),
(
10
);
UPDATE
t1
SET
b
=
SEC_TO_TIME
(
a
);
--
Correct
ORDER
SELECT
a
,
b
FROM
t1
ORDER
BY
b
DESC
;
--
must
be
ordered
as
the
above
SELECT
a
,
b
FROM
t1
ORDER
BY
SEC_TO_TIME
(
a
)
DESC
;
DROP
TABLE
t1
;
#
# BUG#16590: Optimized does not do right "const" table pre-read
#
...
...
mysql-test/t/select.test
View file @
a0499f30
...
...
@@ -3299,4 +3299,51 @@ SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name;
DROP
TABLE
t1
,
t2
;
#
# Bug #26963: join with predicates that contain fields from equalities evaluated
# to constants after constant table substitution
#
CREATE
TABLE
t1
(
access_id
int
NOT
NULL
default
'0'
,
name
varchar
(
20
)
default
NULL
,
rank
int
NOT
NULL
default
'0'
,
KEY
idx
(
access_id
)
);
CREATE
TABLE
t2
(
faq_group_id
int
NOT
NULL
default
'0'
,
faq_id
int
NOT
NULL
default
'0'
,
access_id
int
default
NULL
,
UNIQUE
KEY
idx1
(
faq_id
),
KEY
idx2
(
faq_group_id
,
faq_id
)
);
INSERT
INTO
t1
VALUES
(
1
,
'Everyone'
,
2
),(
2
,
'Help'
,
3
),(
3
,
'Technical Support'
,
1
),(
4
,
'Chat User'
,
4
);
INSERT
INTO
t2
VALUES
(
261
,
265
,
1
),(
490
,
494
,
1
);
SELECT
t2
.
faq_id
FROM
t1
INNER
JOIN
t2
IGNORE
INDEX
(
idx1
)
ON
(
t1
.
access_id
=
t2
.
access_id
)
LEFT
JOIN
t2
t
ON
(
t
.
faq_group_id
=
t2
.
faq_group_id
AND
find_in_set
(
t
.
access_id
,
'1,4'
)
<
find_in_set
(
t2
.
access_id
,
'1,4'
))
WHERE
t2
.
access_id
IN
(
1
,
4
)
AND
t
.
access_id
IS
NULL
AND
t2
.
faq_id
in
(
265
);
SELECT
t2
.
faq_id
FROM
t1
INNER
JOIN
t2
ON
(
t1
.
access_id
=
t2
.
access_id
)
LEFT
JOIN
t2
t
ON
(
t
.
faq_group_id
=
t2
.
faq_group_id
AND
find_in_set
(
t
.
access_id
,
'1,4'
)
<
find_in_set
(
t2
.
access_id
,
'1,4'
))
WHERE
t2
.
access_id
IN
(
1
,
4
)
AND
t
.
access_id
IS
NULL
AND
t2
.
faq_id
in
(
265
);
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.0
tests
mysql-test/t/subselect.test
View file @
a0499f30
...
...
@@ -2736,3 +2736,15 @@ DROP TABLE t1;
DROP
TABLE
t2
;
DROP
TABLE
t1xt2
;
#
# Bug #26728: derived table with concatanation of literals in select list
#
CREATE
TABLE
t1
(
a
int
);
INSERT
INTO
t1
VALUES
(
3
),
(
1
),
(
2
);
SELECT
'this is '
'a test.'
AS
col1
,
a
AS
col2
FROM
t1
;
SELECT
*
FROM
(
SELECT
'this is '
'a test.'
AS
col1
,
a
AS
t2
FROM
t1
)
t
;
DROP
table
t1
;
sql/filesort.cc
View file @
a0499f30
...
...
@@ -1374,7 +1374,10 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
}
else
{
switch
((
sortorder
->
result_type
=
sortorder
->
item
->
result_type
()))
{
sortorder
->
result_type
=
sortorder
->
item
->
result_type
();
if
(
sortorder
->
item
->
result_as_longlong
())
sortorder
->
result_type
=
INT_RESULT
;
switch
(
sortorder
->
result_type
)
{
case
STRING_RESULT
:
sortorder
->
length
=
sortorder
->
item
->
max_length
;
set_if_smaller
(
sortorder
->
length
,
thd
->
variables
.
max_sort_length
);
...
...
sql/item.cc
View file @
a0499f30
...
...
@@ -4127,7 +4127,9 @@ bool Item_field::set_no_const_sub(byte *arg)
DESCRIPTION
The function returns a pointer to an item that is taken from
the very beginning of the item_equal list which the Item_field
object refers to (belongs to).
object refers to (belongs to) unless item_equal contains a constant
item. In this case the function returns this constant item,
(if the substitution does not require conversion).
If the Item_field object does not refer any Item_equal object
'this' is returned
...
...
@@ -4136,7 +4138,8 @@ bool Item_field::set_no_const_sub(byte *arg)
of the thransformer method.
RETURN VALUES
pointer to a replacement Item_field if there is a better equal item;
pointer to a replacement Item_field if there is a better equal item or
a pointer to a constant equal item;
this - otherwise.
*/
...
...
@@ -4144,6 +4147,14 @@ Item *Item_field::replace_equal_field(byte *arg)
{
if
(
item_equal
)
{
Item
*
const_item
=
item_equal
->
get_const
();
if
(
const_item
)
{
if
(
cmp_context
!=
(
Item_result
)
-
1
&&
const_item
->
cmp_context
!=
cmp_context
)
return
this
;
return
const_item
;
}
Item_field
*
subst
=
item_equal
->
get_first
();
if
(
subst
&&
!
field
->
eq
(
subst
->
field
))
return
subst
;
...
...
sql/item.h
View file @
a0499f30
...
...
@@ -1811,7 +1811,11 @@ public:
str_value
.
length
(),
collation
.
collation
);
}
Item
*
safe_charset_converter
(
CHARSET_INFO
*
tocs
);
inline
void
append
(
char
*
str
,
uint
length
)
{
str_value
.
append
(
str
,
length
);
}
inline
void
append
(
char
*
str
,
uint
length
)
{
str_value
.
append
(
str
,
length
);
max_length
=
str_value
.
numchars
()
*
collation
.
collation
->
mbmaxlen
;
}
void
print
(
String
*
str
);
// to prevent drop fixed flag (no need parent cleanup call)
void
cleanup
()
{}
...
...
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