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
b529fed6
Commit
b529fed6
authored
Apr 20, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
BUG#9103 merge to 5.0
sql/sql_select.h: Auto merged
parents
58ffacc4
955ec71f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
8 deletions
+41
-8
mysql-test/r/update.result
mysql-test/r/update.result
+14
-0
mysql-test/t/update.test
mysql-test/t/update.test
+12
-0
sql/opt_range.cc
sql/opt_range.cc
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+13
-6
sql/sql_select.h
sql/sql_select.h
+1
-1
No files found.
mysql-test/r/update.result
View file @
b529fed6
...
@@ -226,3 +226,17 @@ select * from t1;
...
@@ -226,3 +226,17 @@ select * from t1;
a b
a b
0 2
0 2
drop table t1;
drop table t1;
create table t1 (a int, b varchar(10), key b(b(5))) engine=myisam;
create table t2 (a int, b varchar(10)) engine=myisam;
insert into t1 values ( 1, 'abcd1e');
insert into t1 values ( 2, 'abcd2e');
insert into t2 values ( 1, 'abcd1e');
insert into t2 values ( 2, 'abcd2e');
analyze table t1,t2;
Table Op Msg_type Msg_text
test.t1 analyze status OK
test.t2 analyze status OK
update t1, t2 set t1.a = t2.a where t2.b = t1.b;
show warnings;
Level Code Message
drop table t1, t2;
mysql-test/t/update.test
View file @
b529fed6
...
@@ -189,3 +189,15 @@ insert into t1 values (0, '1');
...
@@ -189,3 +189,15 @@ insert into t1 values (0, '1');
update
t1
set
b
=
b
+
1
where
a
=
0
;
update
t1
set
b
=
b
+
1
where
a
=
0
;
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
# BUG#9103 "Erroneous data truncation warnings on multi-table updates"
create
table
t1
(
a
int
,
b
varchar
(
10
),
key
b
(
b
(
5
)))
engine
=
myisam
;
create
table
t2
(
a
int
,
b
varchar
(
10
))
engine
=
myisam
;
insert
into
t1
values
(
1
,
'abcd1e'
);
insert
into
t1
values
(
2
,
'abcd2e'
);
insert
into
t2
values
(
1
,
'abcd1e'
);
insert
into
t2
values
(
2
,
'abcd2e'
);
analyze
table
t1
,
t2
;
update
t1
,
t2
set
t1
.
a
=
t2
.
a
where
t2
.
b
=
t1
.
b
;
show
warnings
;
drop
table
t1
,
t2
;
sql/opt_range.cc
View file @
b529fed6
...
@@ -5532,7 +5532,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
...
@@ -5532,7 +5532,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
goto
err
;
goto
err
;
}
}
if
(
cp_buffer_from_ref
(
ref
)
&&
thd
->
is_fatal_error
||
if
(
cp_buffer_from_ref
(
thd
,
ref
)
&&
thd
->
is_fatal_error
||
!
(
range
=
new
QUICK_RANGE
()))
!
(
range
=
new
QUICK_RANGE
()))
goto
err
;
// out of memory
goto
err
;
// out of memory
...
...
sql/sql_select.cc
View file @
b529fed6
...
@@ -9583,7 +9583,7 @@ join_read_const(JOIN_TAB *tab)
...
@@ -9583,7 +9583,7 @@ join_read_const(JOIN_TAB *tab)
if
(
table
->
status
&
STATUS_GARBAGE
)
// If first read
if
(
table
->
status
&
STATUS_GARBAGE
)
// If first read
{
{
table
->
status
=
0
;
table
->
status
=
0
;
if
(
cp_buffer_from_ref
(
&
tab
->
ref
))
if
(
cp_buffer_from_ref
(
tab
->
join
->
thd
,
&
tab
->
ref
))
error
=
HA_ERR_KEY_NOT_FOUND
;
error
=
HA_ERR_KEY_NOT_FOUND
;
else
else
{
{
...
@@ -9647,7 +9647,7 @@ join_read_always_key(JOIN_TAB *tab)
...
@@ -9647,7 +9647,7 @@ join_read_always_key(JOIN_TAB *tab)
if
(
!
table
->
file
->
inited
)
if
(
!
table
->
file
->
inited
)
table
->
file
->
ha_index_init
(
tab
->
ref
.
key
);
table
->
file
->
ha_index_init
(
tab
->
ref
.
key
);
if
(
cp_buffer_from_ref
(
&
tab
->
ref
))
if
(
cp_buffer_from_ref
(
tab
->
join
->
thd
,
&
tab
->
ref
))
return
-
1
;
return
-
1
;
if
((
error
=
table
->
file
->
index_read
(
table
->
record
[
0
],
if
((
error
=
table
->
file
->
index_read
(
table
->
record
[
0
],
tab
->
ref
.
key_buff
,
tab
->
ref
.
key_buff
,
...
@@ -9674,7 +9674,7 @@ join_read_last_key(JOIN_TAB *tab)
...
@@ -9674,7 +9674,7 @@ join_read_last_key(JOIN_TAB *tab)
if
(
!
table
->
file
->
inited
)
if
(
!
table
->
file
->
inited
)
table
->
file
->
ha_index_init
(
tab
->
ref
.
key
);
table
->
file
->
ha_index_init
(
tab
->
ref
.
key
);
if
(
cp_buffer_from_ref
(
&
tab
->
ref
))
if
(
cp_buffer_from_ref
(
tab
->
join
->
thd
,
&
tab
->
ref
))
return
-
1
;
return
-
1
;
if
((
error
=
table
->
file
->
index_read_last
(
table
->
record
[
0
],
if
((
error
=
table
->
file
->
index_read_last
(
table
->
record
[
0
],
tab
->
ref
.
key_buff
,
tab
->
ref
.
key_buff
,
...
@@ -9848,7 +9848,7 @@ join_ft_read_first(JOIN_TAB *tab)
...
@@ -9848,7 +9848,7 @@ join_ft_read_first(JOIN_TAB *tab)
if
(
!
table
->
file
->
inited
)
if
(
!
table
->
file
->
inited
)
table
->
file
->
ha_index_init
(
tab
->
ref
.
key
);
table
->
file
->
ha_index_init
(
tab
->
ref
.
key
);
#if NOT_USED_YET
#if NOT_USED_YET
if
(
cp_buffer_from_ref
(
&
tab
->
ref
))
// as ft-key doesn't use store_key's
if
(
cp_buffer_from_ref
(
tab
->
join
->
thd
,
&
tab
->
ref
))
// as ft-key doesn't use store_key's
return
-
1
;
// see also FT_SELECT::init()
return
-
1
;
// see also FT_SELECT::init()
#endif
#endif
table
->
file
->
ft_init
();
table
->
file
->
ft_init
();
...
@@ -11609,7 +11609,8 @@ cmp_buffer_with_ref(JOIN_TAB *tab)
...
@@ -11609,7 +11609,8 @@ cmp_buffer_with_ref(JOIN_TAB *tab)
{
{
memcpy
(
tab
->
ref
.
key_buff2
,
tab
->
ref
.
key_buff
,
tab
->
ref
.
key_length
);
memcpy
(
tab
->
ref
.
key_buff2
,
tab
->
ref
.
key_buff
,
tab
->
ref
.
key_length
);
}
}
if
((
tab
->
ref
.
key_err
=
cp_buffer_from_ref
(
&
tab
->
ref
))
||
diff
)
if
((
tab
->
ref
.
key_err
=
cp_buffer_from_ref
(
tab
->
join
->
thd
,
&
tab
->
ref
))
||
diff
)
return
1
;
return
1
;
return
memcmp
(
tab
->
ref
.
key_buff2
,
tab
->
ref
.
key_buff
,
tab
->
ref
.
key_length
)
return
memcmp
(
tab
->
ref
.
key_buff2
,
tab
->
ref
.
key_buff
,
tab
->
ref
.
key_length
)
!=
0
;
!=
0
;
...
@@ -11617,11 +11618,17 @@ cmp_buffer_with_ref(JOIN_TAB *tab)
...
@@ -11617,11 +11618,17 @@ cmp_buffer_with_ref(JOIN_TAB *tab)
bool
bool
cp_buffer_from_ref
(
TABLE_REF
*
ref
)
cp_buffer_from_ref
(
T
HD
*
thd
,
T
ABLE_REF
*
ref
)
{
{
enum
enum_check_fields
save_count_cuted_fields
=
thd
->
count_cuted_fields
;
thd
->
count_cuted_fields
=
CHECK_FIELD_IGNORE
;
for
(
store_key
**
copy
=
ref
->
key_copy
;
*
copy
;
copy
++
)
for
(
store_key
**
copy
=
ref
->
key_copy
;
*
copy
;
copy
++
)
if
((
*
copy
)
->
copy
())
if
((
*
copy
)
->
copy
())
{
thd
->
count_cuted_fields
=
save_count_cuted_fields
;
return
1
;
// Something went wrong
return
1
;
// Something went wrong
}
thd
->
count_cuted_fields
=
save_count_cuted_fields
;
return
0
;
return
0
;
}
}
...
...
sql/sql_select.h
View file @
b529fed6
...
@@ -520,7 +520,7 @@ public:
...
@@ -520,7 +520,7 @@ public:
const
char
*
name
()
const
{
return
"const"
;
}
const
char
*
name
()
const
{
return
"const"
;
}
};
};
bool
cp_buffer_from_ref
(
TABLE_REF
*
ref
);
bool
cp_buffer_from_ref
(
T
HD
*
thd
,
T
ABLE_REF
*
ref
);
bool
error_if_full_join
(
JOIN
*
join
);
bool
error_if_full_join
(
JOIN
*
join
);
int
report_error
(
TABLE
*
table
,
int
error
);
int
report_error
(
TABLE
*
table
,
int
error
);
int
safe_index_read
(
JOIN_TAB
*
tab
);
int
safe_index_read
(
JOIN_TAB
*
tab
);
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