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
f54827e5
Commit
f54827e5
authored
Mar 16, 2004
by
ram@gw.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for the bug #3118: Subquery and order by
parent
0be2ef68
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
3 deletions
+21
-3
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+8
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+8
-0
sql/item.h
sql/item.h
+4
-2
sql/item_func.cc
sql/item_func.cc
+1
-1
No files found.
mysql-test/r/subselect.result
View file @
f54827e5
...
...
@@ -1624,3 +1624,11 @@ select 2 in (select * from t1);
1
SET SQL_SELECT_LIMIT=default;
drop table t1;
CREATE TABLE t1 (a int, b int, INDEX (a));
INSERT INTO t1 VALUES (1, 1), (1, 2), (1, 3);
SELECT * FROM t1 WHERE a = (SELECT MAX(a) FROM t1 WHERE a = 1) ORDER BY b;
a b
1 1
1 2
1 3
DROP TABLE t1;
mysql-test/t/subselect.test
View file @
f54827e5
...
...
@@ -1066,3 +1066,11 @@ select 2 in (select * from t1);
SET
SQL_SELECT_LIMIT
=
default
;
drop
table
t1
;
#
# Bug #3118: subselect + order by
#
CREATE
TABLE
t1
(
a
int
,
b
int
,
INDEX
(
a
));
INSERT
INTO
t1
VALUES
(
1
,
1
),
(
1
,
2
),
(
1
,
3
);
SELECT
*
FROM
t1
WHERE
a
=
(
SELECT
MAX
(
a
)
FROM
t1
WHERE
a
=
1
)
ORDER
BY
b
;
DROP
TABLE
t1
;
sql/item.h
View file @
f54827e5
...
...
@@ -428,8 +428,10 @@ class Item_uint :public Item_int
{
public:
Item_uint
(
const
char
*
str_arg
,
uint
length
)
:
Item_int
(
str_arg
,
(
longlong
)
strtoull
(
str_arg
,(
char
**
)
0
,
10
),
length
)
{}
Item_uint
(
uint32
i
)
:
Item_int
((
longlong
)
i
,
10
)
{}
Item_int
(
str_arg
,
(
longlong
)
strtoull
(
str_arg
,(
char
**
)
0
,
10
),
length
)
{
fixed
=
0
;
}
Item_uint
(
uint32
i
)
:
Item_int
((
longlong
)
i
,
10
)
{
fixed
=
0
;
}
double
val
()
{
return
ulonglong2double
((
ulonglong
)
value
);
}
String
*
val_str
(
String
*
);
Item
*
new_item
()
{
return
new
Item_uint
(
name
,
max_length
);
}
...
...
sql/item_func.cc
View file @
f54827e5
...
...
@@ -205,7 +205,7 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
Item
*
item
;
/* We can't yet set item to *arg as fix_fields may change *arg */
if
((
*
arg
)
->
fix_fields
(
thd
,
tables
,
arg
)
||
if
((
!
(
*
arg
)
->
fixed
&&
(
*
arg
)
->
fix_fields
(
thd
,
tables
,
arg
)
)
||
(
*
arg
)
->
check_cols
(
allowed_arg_cols
))
return
1
;
/* purecov: inspected */
item
=
*
arg
;
...
...
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