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
cfb4a66a
Commit
cfb4a66a
authored
Sep 03, 2008
by
Gleb Shchepa
Browse files
Options
Browse Files
Download
Plain Diff
merge with local tree
parents
0e3bc47f
6f94324f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
0 deletions
+41
-0
mysql-test/r/default.result
mysql-test/r/default.result
+15
-0
mysql-test/t/default.test
mysql-test/t/default.test
+19
-0
sql/item.cc
sql/item.cc
+7
-0
No files found.
mysql-test/r/default.result
View file @
cfb4a66a
...
@@ -205,4 +205,19 @@ Warnings:
...
@@ -205,4 +205,19 @@ Warnings:
Warning 1364 Field 'id' doesn't have a default value
Warning 1364 Field 'id' doesn't have a default value
drop view v1;
drop view v1;
drop table t1;
drop table t1;
create table t1 (a int unique);
create table t2 (b int default 10);
insert into t1 (a) values (1);
insert into t2 (b) values (1);
insert into t1 (a) select b from t2 on duplicate key update a=default;
select * from t1;
a
NULL
insert into t1 (a) values (1);
insert into t1 (a) select b from t2 on duplicate key update a=default(b);
select * from t1;
a
NULL
10
drop table t1, t2;
End of 5.0 tests.
End of 5.0 tests.
mysql-test/t/default.test
View file @
cfb4a66a
...
@@ -145,5 +145,24 @@ insert into t1 values(default);
...
@@ -145,5 +145,24 @@ insert into t1 values(default);
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #39002: crash with
# INSERT ... SELECT ... ON DUPLICATE KEY UPDATE col=DEFAULT
#
create
table
t1
(
a
int
unique
);
create
table
t2
(
b
int
default
10
);
insert
into
t1
(
a
)
values
(
1
);
insert
into
t2
(
b
)
values
(
1
);
insert
into
t1
(
a
)
select
b
from
t2
on
duplicate
key
update
a
=
default
;
select
*
from
t1
;
insert
into
t1
(
a
)
values
(
1
);
insert
into
t1
(
a
)
select
b
from
t2
on
duplicate
key
update
a
=
default
(
b
);
select
*
from
t1
;
drop
table
t1
,
t2
;
--
echo
End
of
5.0
tests
.
--
echo
End
of
5.0
tests
.
sql/item.cc
View file @
cfb4a66a
...
@@ -6046,6 +6046,13 @@ Item *Item_default_value::transform(Item_transformer transformer, byte *args)
...
@@ -6046,6 +6046,13 @@ Item *Item_default_value::transform(Item_transformer transformer, byte *args)
{
{
DBUG_ASSERT
(
!
current_thd
->
is_stmt_prepare
());
DBUG_ASSERT
(
!
current_thd
->
is_stmt_prepare
());
/*
If the value of arg is NULL, then this object represents a constant,
so further transformation is unnecessary (and impossible).
*/
if
(
!
arg
)
return
0
;
Item
*
new_item
=
arg
->
transform
(
transformer
,
args
);
Item
*
new_item
=
arg
->
transform
(
transformer
,
args
);
if
(
!
new_item
)
if
(
!
new_item
)
return
0
;
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