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
381b6808
Commit
381b6808
authored
Oct 08, 2003
by
bell@laptop.sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed error handling in SET and DO operators (BUG#1484)
parent
9b401806
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
5 deletions
+60
-5
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+7
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+14
-0
sql/set_var.cc
sql/set_var.cc
+38
-5
sql/sql_do.cc
sql/sql_do.cc
+1
-0
No files found.
mysql-test/r/subselect.result
View file @
381b6808
...
...
@@ -1439,3 +1439,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
drop table if exists t2, t3;
create table t1 (s1 int);
insert into t1 values (1);
insert into t1 values (2);
set sort_buffer_size = (select s1 from t1);
ERROR 21000: Subquery returns more than 1 row
do (select * from t1);
drop table t1;
mysql-test/t/subselect.test
View file @
381b6808
...
...
@@ -951,6 +951,7 @@ select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
explain
select
s1
,
s1
NOT
IN
(
SELECT
s1
FROM
t2
)
from
t1
;
explain
select
s1
,
s1
NOT
IN
(
SELECT
s1
FROM
t2
WHERE
s1
<
'a2'
)
from
t1
;
drop
table
t1
,
t2
;
#
# correct ALL optimisation
#
...
...
@@ -960,8 +961,21 @@ insert into t3 values (6),(7),(3);
select
*
from
t3
where
a
>=
all
(
select
b
from
t2
);
explain
select
*
from
t3
where
a
>=
all
(
select
b
from
t2
);
#
# optimized static ALL/ANY with grouping
#
insert
into
t2
values
(
2
,
2
),
(
2
,
1
),
(
3
,
3
),
(
3
,
1
);
select
*
from
t3
where
a
>
all
(
select
max
(
b
)
from
t2
group
by
a
);
explain
select
*
from
t3
where
a
>
all
(
select
max
(
b
)
from
t2
group
by
a
);
drop
table
if
exists
t2
,
t3
;
#
# DO and SET with errors
#
create
table
t1
(
s1
int
);
insert
into
t1
values
(
1
);
insert
into
t1
values
(
2
);
--
error
1241
set
sort_buffer_size
=
(
select
s1
from
t1
);
do
(
select
*
from
t1
);
drop
table
t1
;
sql/set_var.cc
View file @
381b6808
...
...
@@ -859,6 +859,8 @@ void fix_max_relay_log_size(THD *thd, enum_var_type type)
bool
sys_var_long_ptr
::
update
(
THD
*
thd
,
set_var
*
var
)
{
ulonglong
tmp
=
var
->
value
->
val_int
();
if
(
thd
->
net
.
report_error
)
return
1
;
pthread_mutex_lock
(
&
LOCK_global_system_variables
);
if
(
option_limits
)
*
value
=
(
ulong
)
getopt_ull_limit_value
(
tmp
,
option_limits
);
...
...
@@ -878,6 +880,8 @@ void sys_var_long_ptr::set_default(THD *thd, enum_var_type type)
bool
sys_var_ulonglong_ptr
::
update
(
THD
*
thd
,
set_var
*
var
)
{
ulonglong
tmp
=
var
->
value
->
val_int
();
if
(
thd
->
net
.
report_error
)
return
1
;
pthread_mutex_lock
(
&
LOCK_global_system_variables
);
if
(
option_limits
)
*
value
=
(
ulonglong
)
getopt_ull_limit_value
(
tmp
,
option_limits
);
...
...
@@ -925,6 +929,8 @@ byte *sys_var_enum::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
bool
sys_var_thd_ulong
::
update
(
THD
*
thd
,
set_var
*
var
)
{
ulonglong
tmp
=
var
->
value
->
val_int
();
if
(
thd
->
net
.
report_error
)
return
1
;
/* Don't use bigger value than given with --maximum-variable-name=.. */
if
((
ulong
)
tmp
>
max_system_variables
.
*
offset
)
...
...
@@ -964,6 +970,8 @@ byte *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type,
bool
sys_var_thd_ha_rows
::
update
(
THD
*
thd
,
set_var
*
var
)
{
ulonglong
tmp
=
var
->
value
->
val_int
();
if
(
thd
->
net
.
report_error
)
return
1
;
/* Don't use bigger value than given with --maximum-variable-name=.. */
if
((
ha_rows
)
tmp
>
max_system_variables
.
*
offset
)
...
...
@@ -1010,6 +1018,8 @@ byte *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type,
bool
sys_var_thd_ulonglong
::
update
(
THD
*
thd
,
set_var
*
var
)
{
ulonglong
tmp
=
var
->
value
->
val_int
();
if
(
thd
->
net
.
report_error
)
return
1
;
if
((
ulonglong
)
tmp
>
max_system_variables
.
*
offset
)
tmp
=
max_system_variables
.
*
offset
;
...
...
@@ -1581,6 +1591,9 @@ void sys_var_collation_server::set_default(THD *thd, enum_var_type type)
bool
sys_var_key_buffer_size
::
update
(
THD
*
thd
,
set_var
*
var
)
{
ulonglong
tmp
=
var
->
value
->
val_int
();
if
(
thd
->
net
.
report_error
)
return
1
;
NAMED_LIST
*
list
;
LEX_STRING
*
base_name
=
&
var
->
base
;
...
...
@@ -1676,7 +1689,11 @@ int set_var_collation_client::update(THD *thd)
bool
sys_var_timestamp
::
update
(
THD
*
thd
,
set_var
*
var
)
{
thd
->
set_time
((
time_t
)
var
->
value
->
val_int
());
time_t
tmp
=
(
time_t
)
var
->
value
->
val_int
();
if
(
thd
->
net
.
report_error
)
return
1
;
thd
->
set_time
(
tmp
);
return
0
;
}
...
...
@@ -1697,7 +1714,11 @@ byte *sys_var_timestamp::value_ptr(THD *thd, enum_var_type type,
bool
sys_var_last_insert_id
::
update
(
THD
*
thd
,
set_var
*
var
)
{
thd
->
insert_id
(
var
->
value
->
val_int
());
ulonglong
tmp
=
var
->
value
->
val_int
();
if
(
thd
->
net
.
report_error
)
return
1
;
thd
->
insert_id
(
tmp
);
return
0
;
}
...
...
@@ -1712,7 +1733,11 @@ byte *sys_var_last_insert_id::value_ptr(THD *thd, enum_var_type type,
bool
sys_var_insert_id
::
update
(
THD
*
thd
,
set_var
*
var
)
{
thd
->
next_insert_id
=
var
->
value
->
val_int
();
ulonglong
tmp
=
var
->
value
->
val_int
();
if
(
thd
->
net
.
report_error
)
return
1
;
thd
->
next_insert_id
=
tmp
;
return
0
;
}
...
...
@@ -1779,13 +1804,21 @@ bool sys_var_slave_skip_counter::update(THD *thd, set_var *var)
bool
sys_var_rand_seed1
::
update
(
THD
*
thd
,
set_var
*
var
)
{
thd
->
rand
.
seed1
=
(
ulong
)
var
->
value
->
val_int
();
ulong
tmp
=
(
ulong
)
var
->
value
->
val_int
();
if
(
thd
->
net
.
report_error
)
return
1
;
thd
->
rand
.
seed1
=
tmp
;
return
0
;
}
bool
sys_var_rand_seed2
::
update
(
THD
*
thd
,
set_var
*
var
)
{
thd
->
rand
.
seed2
=
(
ulong
)
var
->
value
->
val_int
();
ulong
tmp
=
(
ulong
)
var
->
value
->
val_int
();
if
(
thd
->
net
.
report_error
)
return
1
;
thd
->
rand
.
seed2
=
tmp
;
return
0
;
}
...
...
sql/sql_do.cc
View file @
381b6808
...
...
@@ -29,6 +29,7 @@ int mysql_do(THD *thd, List<Item> &values)
DBUG_RETURN
(
-
1
);
while
((
value
=
li
++
))
value
->
val_int
();
thd
->
clear_error
();
// DO always is OK
send_ok
(
thd
);
DBUG_RETURN
(
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