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
6562df20
Commit
6562df20
authored
Jan 23, 2007
by
dlenev@mockturtle.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into mockturtle.local:/home/dlenev/src/mysql-5.0-bg24491
parents
ddffdd1c
2b63f106
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
7 deletions
+100
-7
mysql-test/r/ps.result
mysql-test/r/ps.result
+16
-0
mysql-test/r/sp-error.result
mysql-test/r/sp-error.result
+19
-0
mysql-test/t/ps.test
mysql-test/t/ps.test
+31
-0
mysql-test/t/sp-error.test
mysql-test/t/sp-error.test
+32
-0
sql/item.h
sql/item.h
+2
-7
No files found.
mysql-test/r/ps.result
View file @
6562df20
...
...
@@ -1645,4 +1645,20 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COMMENT='comment for table t1'
deallocate prepare stmt;
drop table t1, t2;
drop tables if exists t1;
create table t1 (id int primary key auto_increment, value varchar(10));
insert into t1 (id, value) values (1, 'FIRST'), (2, 'SECOND'), (3, 'THIRD');
prepare stmt from "insert into t1 (id, value) select * from (select 4 as i, 'FOURTH' as v) as y on duplicate key update v = 'DUP'";
execute stmt;
ERROR 42S22: Unknown column 'v' in 'field list'
execute stmt;
ERROR 42S22: Unknown column 'v' in 'field list'
deallocate prepare stmt;
prepare stmt from "insert into t1 (id, value) select * from (select 4 as id, 'FOURTH' as value) as y on duplicate key update y.value = 'DUP'";
execute stmt;
ERROR 42S22: Unknown column 'y.value' in 'field list'
execute stmt;
ERROR 42S22: Unknown column 'y.value' in 'field list'
deallocate prepare stmt;
drop tables t1;
End of 5.0 tests.
mysql-test/r/sp-error.result
View file @
6562df20
...
...
@@ -1250,3 +1250,22 @@ ERROR HY000: View's SELECT contains a variable or parameter
PREPARE stmt FROM "CREATE VIEW v AS SELECT ?";
ERROR HY000: View's SELECT contains a variable or parameter
DROP TABLE t1;
drop tables if exists t1;
drop procedure if exists bug24491;
create table t1 (id int primary key auto_increment, value varchar(10));
insert into t1 (id, value) values (1, 'FIRST'), (2, 'SECOND'), (3, 'THIRD');
create procedure bug24491()
insert into t1 (id, value) select * from (select 4 as i, 'FOURTH' as v) as y on duplicate key update v = 'DUP';
call bug24491();
ERROR 42S22: Unknown column 'v' in 'field list'
call bug24491();
ERROR 42S22: Unknown column 'v' in 'field list'
drop procedure bug24491;
create procedure bug24491()
insert into t1 (id, value) select * from (select 4 as id, 'FOURTH' as value) as y on duplicate key update y.value = 'DUP';
call bug24491();
ERROR 42S22: Unknown column 'y.value' in 'field list'
call bug24491();
ERROR 42S22: Unknown column 'y.value' in 'field list'
drop procedure bug24491;
drop tables t1;
mysql-test/t/ps.test
View file @
6562df20
...
...
@@ -1647,6 +1647,7 @@ execute sq;
deallocate
prepare
no_index
;
deallocate
prepare
sq
;
#
# Bug 25027: query with a single-row non-correlated subquery
# and IS NULL predicate
...
...
@@ -1741,4 +1742,34 @@ drop table t1, t2;
#deallocate prepare stmt;
#set @@character_set_server= @old_character_set_server;
#
# BUG#24491 "using alias from source table in insert ... on duplicate key"
#
--
disable_warnings
drop
tables
if
exists
t1
;
--
enable_warnings
create
table
t1
(
id
int
primary
key
auto_increment
,
value
varchar
(
10
));
insert
into
t1
(
id
,
value
)
values
(
1
,
'FIRST'
),
(
2
,
'SECOND'
),
(
3
,
'THIRD'
);
# Let us prepare INSERT ... SELECT ... ON DUPLICATE KEY UPDATE statement
# which in its ON DUPLICATE KEY clause erroneously tries to assign value
# to a column which is mentioned only in SELECT part.
prepare
stmt
from
"insert into t1 (id, value) select * from (select 4 as i, 'FOURTH' as v) as y on duplicate key update v = 'DUP'"
;
# Both first and second attempts to execute it should fail
--
error
ER_BAD_FIELD_ERROR
execute
stmt
;
--
error
ER_BAD_FIELD_ERROR
execute
stmt
;
deallocate
prepare
stmt
;
# And now the same test for more complex case which is more close
# to the one that was reported originally.
prepare
stmt
from
"insert into t1 (id, value) select * from (select 4 as id, 'FOURTH' as value) as y on duplicate key update y.value = 'DUP'"
;
--
error
ER_BAD_FIELD_ERROR
execute
stmt
;
--
error
ER_BAD_FIELD_ERROR
execute
stmt
;
deallocate
prepare
stmt
;
drop
tables
t1
;
--
echo
End
of
5.0
tests
.
mysql-test/t/sp-error.test
View file @
6562df20
...
...
@@ -1808,6 +1808,38 @@ PREPARE stmt FROM "CREATE VIEW v AS SELECT ?";
DROP
TABLE
t1
;
#
# BUG#24491 "using alias from source table in insert ... on duplicate key"
#
--
disable_warnings
drop
tables
if
exists
t1
;
drop
procedure
if
exists
bug24491
;
--
enable_warnings
create
table
t1
(
id
int
primary
key
auto_increment
,
value
varchar
(
10
));
insert
into
t1
(
id
,
value
)
values
(
1
,
'FIRST'
),
(
2
,
'SECOND'
),
(
3
,
'THIRD'
);
# Let us create routine with INSERT ... SELECT ... ON DUPLICATE KEY UPDATE
# statement which in its ON DUPLICATE KEY clause erroneously tries to assign
# value to a column which is mentioned only in SELECT part.
create
procedure
bug24491
()
insert
into
t1
(
id
,
value
)
select
*
from
(
select
4
as
i
,
'FOURTH'
as
v
)
as
y
on
duplicate
key
update
v
=
'DUP'
;
# Both first and second calls to it should fail
--
error
ER_BAD_FIELD_ERROR
call
bug24491
();
--
error
ER_BAD_FIELD_ERROR
call
bug24491
();
drop
procedure
bug24491
;
# And now the same test for more complex case which is more close
# to the one that was reported originally.
create
procedure
bug24491
()
insert
into
t1
(
id
,
value
)
select
*
from
(
select
4
as
id
,
'FOURTH'
as
value
)
as
y
on
duplicate
key
update
y
.
value
=
'DUP'
;
--
error
ER_BAD_FIELD_ERROR
call
bug24491
();
--
error
ER_BAD_FIELD_ERROR
call
bug24491
();
drop
procedure
bug24491
;
drop
tables
t1
;
#
# BUG#NNNN: New bug synopsis
#
...
...
sql/item.h
View file @
6562df20
...
...
@@ -336,23 +336,18 @@ public:
{
save_table_list
=
context
->
table_list
;
save_first_name_resolution_table
=
context
->
first_name_resolution_table
;
save_next_name_resolution_table
=
(
context
->
first_name_resolution_table
)
?
context
->
first_name_resolution_table
->
next_name_resolution_table
:
NULL
;
save_resolve_in_select_list
=
context
->
resolve_in_select_list
;
save_next_local
=
table_list
->
next_local
;
save_next_name_resolution_table
=
table_list
->
next_name_resolution_table
;
}
/* Restore a name resolution context from saved state. */
void
restore_state
(
Name_resolution_context
*
context
,
TABLE_LIST
*
table_list
)
{
table_list
->
next_local
=
save_next_local
;
table_list
->
next_name_resolution_table
=
save_next_name_resolution_table
;
context
->
table_list
=
save_table_list
;
context
->
first_name_resolution_table
=
save_first_name_resolution_table
;
if
(
context
->
first_name_resolution_table
)
context
->
first_name_resolution_table
->
next_name_resolution_table
=
save_next_name_resolution_table
;
context
->
resolve_in_select_list
=
save_resolve_in_select_list
;
}
};
...
...
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