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
730776c4
Commit
730776c4
authored
Jun 29, 2003
by
monty@mashka.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed 'Unknown error' when doing ORDER BY on reference table which
was used with NULL value on NOT NULL column. (Bug #479)
parent
dcbcb785
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
1 deletion
+40
-1
mysql-test/r/order_by.result
mysql-test/r/order_by.result
+4
-0
mysql-test/t/order_by.test
mysql-test/t/order_by.test
+23
-0
sql/sql_select.cc
sql/sql_select.cc
+13
-1
No files found.
mysql-test/r/order_by.result
View file @
730776c4
...
@@ -142,3 +142,7 @@ t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 where used
...
@@ -142,3 +142,7 @@ t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 where used
table type possible_keys key key_len ref rows Extra
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
t3 eq_ref PRIMARY PRIMARY 2 t1.skr 1 where used
t3 eq_ref PRIMARY PRIMARY 2 t1.skr 1 where used
t2_id str
112633 t2 112633
112634 t2 112634
t2_id str
mysql-test/t/order_by.test
View file @
730776c4
...
@@ -247,3 +247,26 @@ EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and
...
@@ -247,3 +247,26 @@ EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and
EXPLAIN
SELECT
t1
.
gid
,
t3
.
uid
from
t1
,
t3
where
t1
.
gid
=
t3
.
uid
order
by
t3
.
skr
,
t1
.
gid
;
EXPLAIN
SELECT
t1
.
gid
,
t3
.
uid
from
t1
,
t3
where
t1
.
gid
=
t3
.
uid
order
by
t3
.
skr
,
t1
.
gid
;
EXPLAIN
SELECT
t1
.
gid
,
t3
.
uid
from
t1
,
t3
where
t1
.
skr
=
t3
.
uid
order
by
t1
.
gid
,
t3
.
skr
;
EXPLAIN
SELECT
t1
.
gid
,
t3
.
uid
from
t1
,
t3
where
t1
.
skr
=
t3
.
uid
order
by
t1
.
gid
,
t3
.
skr
;
drop
table
t1
,
t2
,
t3
;
drop
table
t1
,
t2
,
t3
;
#
# Problem with lookup on NULL (Bug 479)
#
CREATE
TABLE
t1
(
t1_id
int
(
10
)
unsigned
NOT
NULL
default
'0'
,
ref_id
int
(
10
)
unsigned
default
NULL
,
PRIMARY
KEY
(
t1_id
)
)
TYPE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
2401
,
14590
),(
2425
,
NULL
);
CREATE
TABLE
t2
(
t2_id
int
(
10
)
unsigned
NOT
NULL
default
'0'
,
ref_id
int
(
10
)
unsigned
NOT
NULL
default
'0'
,
str
varchar
(
20
)
default
NULL
,
PRIMARY
KEY
(
t2_id
),
KEY
ref_id
(
ref_id
)
)
TYPE
=
MyISAM
;
INSERT
INTO
t2
VALUES
(
112633
,
14590
,
't2 112633'
),(
112634
,
14590
,
't2 112634'
),(
113166
,
14641
,
't2 113166'
),(
113167
,
14641
,
't2 113167'
),(
113168
,
14641
,
't2 113168'
),(
113169
,
14641
,
't2 113169'
),(
113170
,
14641
,
't2 113170'
),(
113171
,
14641
,
't2 113171'
),(
113172
,
14641
,
't2 113172'
),(
113173
,
14641
,
't2 113173'
),(
113174
,
14641
,
't2 113174'
),(
113175
,
14641
,
't2 113175'
),(
113436
,
14674
,
't2 113436'
),(
113437
,
14674
,
't2 113437'
),(
113486
,
14689
,
't2 113486'
),(
113487
,
14689
,
't2 113487'
),(
113488
,
14689
,
't2 113488'
),(
113489
,
14689
,
't2 113489'
),(
113504
,
14795
,
't2 113504'
),(
115396
,
15024
,
't2 115396'
),(
115397
,
15024
,
't2 115397'
);
SELECT
t2_id
,
str
FROM
t1
,
t2
WHERE
t1_id
=
2401
AND
t1
.
ref_id
=
t2
.
ref_id
ORDER
BY
str
,
t2_id
;
# This one gave an error
SELECT
t2_id
,
str
FROM
t1
,
t2
WHERE
t1_id
=
2425
AND
t1
.
ref_id
=
t2
.
ref_id
ORDER
BY
str
,
t2_id
;
DROP
TABLE
t1
,
t2
;
sql/sql_select.cc
View file @
730776c4
...
@@ -5326,11 +5326,23 @@ create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit)
...
@@ -5326,11 +5326,23 @@ create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit)
can use.
can use.
*/
*/
if
(
!
(
select
->
quick
=
get_ft_or_quick_select_for_ref
(
table
,
tab
)))
if
(
!
(
select
->
quick
=
get_ft_or_quick_select_for_ref
(
table
,
tab
)))
goto
err
;
{
if
(
current_thd
->
fatal_error
)
goto
err
;
// End of memory
/*
Impossible range (for example lookup on NULL on not null field)
Create empty result set
*/
if
(
!
(
table
->
record_pointers
=
my_malloc
(
1
,
MYF
(
MY_WME
))))
goto
err
;
table
->
found_records
=
0
;
goto
end
;
}
}
}
}
}
table
->
found_records
=
filesort
(
&
table
,
sortorder
,
length
,
table
->
found_records
=
filesort
(
&
table
,
sortorder
,
length
,
select
,
0L
,
select_limit
,
&
examined_rows
);
select
,
0L
,
select_limit
,
&
examined_rows
);
end:
delete
select
;
// filesort did select
delete
select
;
// filesort did select
tab
->
select
=
0
;
tab
->
select
=
0
;
tab
->
select_cond
=
0
;
tab
->
select_cond
=
0
;
...
...
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