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
6aa599fc
Commit
6aa599fc
authored
Apr 03, 2007
by
igor@olga.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge olga.mysql.com:/home/igor/mysql-4.1-opt
into olga.mysql.com:/home/igor/mysql-5.0-opt
parents
54bc9c3d
90aa05d2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
1 deletion
+109
-1
mysql-test/r/order_by.result
mysql-test/r/order_by.result
+59
-0
mysql-test/t/order_by.test
mysql-test/t/order_by.test
+29
-1
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+20
-0
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+1
-0
No files found.
mysql-test/r/order_by.result
View file @
6aa599fc
...
@@ -906,6 +906,65 @@ ERROR 23000: Column 'val' in order clause is ambiguous
...
@@ -906,6 +906,65 @@ ERROR 23000: Column 'val' in order clause is ambiguous
SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1;
SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1;
ERROR 23000: Column 'val' in order clause is ambiguous
ERROR 23000: Column 'val' in order clause is ambiguous
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (3), (2), (4), (1);
SELECT a, IF(a IN (2,3), a, a+10) FROM t1
ORDER BY IF(a IN (2,3), a, a+10);
a IF(a IN (2,3), a, a+10)
2 2
3 3
1 11
4 14
SELECT a, IF(a NOT IN (2,3), a, a+10) FROM t1
ORDER BY IF(a NOT IN (2,3), a, a+10);
a IF(a NOT IN (2,3), a, a+10)
1 1
4 4
2 12
3 13
SELECT a, IF(a IN (2,3), a, a+10) FROM t1
ORDER BY IF(a NOT IN (2,3), a, a+10);
a IF(a IN (2,3), a, a+10)
1 11
4 14
2 2
3 3
SELECT a, IF(a BETWEEN 2 AND 3, a, a+10) FROM t1
ORDER BY IF(a BETWEEN 2 AND 3, a, a+10);
a IF(a BETWEEN 2 AND 3, a, a+10)
2 2
3 3
1 11
4 14
SELECT a, IF(a NOT BETWEEN 2 AND 3, a, a+10) FROM t1
ORDER BY IF(a NOT BETWEEN 2 AND 3, a, a+10);
a IF(a NOT BETWEEN 2 AND 3, a, a+10)
1 1
4 4
2 12
3 13
SELECT a, IF(a BETWEEN 2 AND 3, a, a+10) FROM t1
ORDER BY IF(a NOT BETWEEN 2 AND 3, a, a+10);
a IF(a BETWEEN 2 AND 3, a, a+10)
1 11
4 14
2 2
3 3
SELECT IF(a IN (1,2), a, '') as x1, IF(a NOT IN (1,2), a, '') as x2
FROM t1 GROUP BY x1, x2;
x1 x2
3
4
1
2
SELECT IF(a IN (1,2), a, '') as x1, IF(a NOT IN (1,2), a, '') as x2
FROM t1 GROUP BY x1, IF(a NOT IN (1,2), a, '');
x1 x2
3
4
1
2
DROP TABLE t1;
create table t1 (a int not null, b int not null, c int not null);
create table t1 (a int not null, b int not null, c int not null);
insert t1 values (1,1,1),(1,1,2),(1,2,1);
insert t1 values (1,1,1),(1,1,2),(1,2,1);
select a, b from t1 group by a, b order by sum(c);
select a, b from t1 group by a, b order by sum(c);
...
...
mysql-test/t/order_by.test
View file @
6aa599fc
...
@@ -617,7 +617,6 @@ UPDATE bug25126 SET MissingCol = val ORDER BY MissingCol;
...
@@ -617,7 +617,6 @@ UPDATE bug25126 SET MissingCol = val ORDER BY MissingCol;
UPDATE
bug25126
SET
MissingCol
=
MissingCol
ORDER
BY
MissingCol
;
UPDATE
bug25126
SET
MissingCol
=
MissingCol
ORDER
BY
MissingCol
;
DROP
TABLE
bug25126
;
DROP
TABLE
bug25126
;
#
#
# Bug #25427: crash when order by expression contains a name
# Bug #25427: crash when order by expression contains a name
# that cannot be resolved unambiguously
# that cannot be resolved unambiguously
...
@@ -633,6 +632,35 @@ SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1;
...
@@ -633,6 +632,35 @@ SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug #27532: ORDER/GROUP BY expressions with IN/BETWEEN and NOT IN/BETWEEN
#
CREATE
TABLE
t1
(
a
int
);
INSERT
INTO
t1
VALUES
(
3
),
(
2
),
(
4
),
(
1
);
SELECT
a
,
IF
(
a
IN
(
2
,
3
),
a
,
a
+
10
)
FROM
t1
ORDER
BY
IF
(
a
IN
(
2
,
3
),
a
,
a
+
10
);
SELECT
a
,
IF
(
a
NOT
IN
(
2
,
3
),
a
,
a
+
10
)
FROM
t1
ORDER
BY
IF
(
a
NOT
IN
(
2
,
3
),
a
,
a
+
10
);
SELECT
a
,
IF
(
a
IN
(
2
,
3
),
a
,
a
+
10
)
FROM
t1
ORDER
BY
IF
(
a
NOT
IN
(
2
,
3
),
a
,
a
+
10
);
SELECT
a
,
IF
(
a
BETWEEN
2
AND
3
,
a
,
a
+
10
)
FROM
t1
ORDER
BY
IF
(
a
BETWEEN
2
AND
3
,
a
,
a
+
10
);
SELECT
a
,
IF
(
a
NOT
BETWEEN
2
AND
3
,
a
,
a
+
10
)
FROM
t1
ORDER
BY
IF
(
a
NOT
BETWEEN
2
AND
3
,
a
,
a
+
10
);
SELECT
a
,
IF
(
a
BETWEEN
2
AND
3
,
a
,
a
+
10
)
FROM
t1
ORDER
BY
IF
(
a
NOT
BETWEEN
2
AND
3
,
a
,
a
+
10
);
SELECT
IF
(
a
IN
(
1
,
2
),
a
,
''
)
as
x1
,
IF
(
a
NOT
IN
(
1
,
2
),
a
,
''
)
as
x2
FROM
t1
GROUP
BY
x1
,
x2
;
SELECT
IF
(
a
IN
(
1
,
2
),
a
,
''
)
as
x1
,
IF
(
a
NOT
IN
(
1
,
2
),
a
,
''
)
as
x2
FROM
t1
GROUP
BY
x1
,
IF
(
a
NOT
IN
(
1
,
2
),
a
,
''
);
DROP
TABLE
t1
;
# End of 4.1
create
table
t1
(
a
int
not
null
,
b
int
not
null
,
c
int
not
null
);
create
table
t1
(
a
int
not
null
,
b
int
not
null
,
c
int
not
null
);
insert
t1
values
(
1
,
1
,
1
),(
1
,
1
,
2
),(
1
,
2
,
1
);
insert
t1
values
(
1
,
1
,
1
),(
1
,
1
,
2
),(
1
,
2
,
1
);
select
a
,
b
from
t1
group
by
a
,
b
order
by
sum
(
c
);
select
a
,
b
from
t1
group
by
a
,
b
order
by
sum
(
c
);
...
...
sql/item_cmpfunc.cc
View file @
6aa599fc
...
@@ -1079,6 +1079,26 @@ longlong Item_func_strcmp::val_int()
...
@@ -1079,6 +1079,26 @@ longlong Item_func_strcmp::val_int()
}
}
bool
Item_func_opt_neg
::
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
{
/* Assume we don't have rtti */
if
(
this
==
item
)
return
1
;
if
(
item
->
type
()
!=
FUNC_ITEM
)
return
0
;
Item_func
*
item_func
=
(
Item_func
*
)
item
;
if
(
arg_count
!=
item_func
->
arg_count
||
functype
()
!=
item_func
->
functype
())
return
0
;
if
(
negated
!=
((
Item_func_opt_neg
*
)
item_func
)
->
negated
)
return
0
;
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
if
(
!
args
[
i
]
->
eq
(
item_func
->
arguments
()[
i
],
binary_cmp
))
return
0
;
return
1
;
}
void
Item_func_interval
::
fix_length_and_dec
()
void
Item_func_interval
::
fix_length_and_dec
()
{
{
use_decimal_comparison
=
(
row
->
element_index
(
0
)
->
result_type
()
==
DECIMAL_RESULT
)
||
use_decimal_comparison
=
(
row
->
element_index
(
0
)
->
result_type
()
==
DECIMAL_RESULT
)
||
...
...
sql/item_cmpfunc.h
View file @
6aa599fc
...
@@ -561,6 +561,7 @@ public:
...
@@ -561,6 +561,7 @@ public:
negated
=
!
negated
;
negated
=
!
negated
;
return
this
;
return
this
;
}
}
bool
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
;
bool
subst_argument_checker
(
byte
**
arg
)
{
return
TRUE
;
}
bool
subst_argument_checker
(
byte
**
arg
)
{
return
TRUE
;
}
};
};
...
...
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