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
b728d0a6
Commit
b728d0a6
authored
Jun 28, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into magare.gmz:/home/kgeorge/mysql/autopush/B26642-5.0-opt
parents
0c31d0bb
00b3d3c2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
80 additions
and
45 deletions
+80
-45
mysql-test/r/errors.result
mysql-test/r/errors.result
+14
-0
mysql-test/t/errors.test
mysql-test/t/errors.test
+13
-0
sql/sql_class.h
sql/sql_class.h
+1
-0
sql/sql_insert.cc
sql/sql_insert.cc
+51
-41
sql/sql_select.cc
sql/sql_select.cc
+1
-4
No files found.
mysql-test/r/errors.result
View file @
b728d0a6
...
@@ -41,3 +41,17 @@ SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
...
@@ -41,3 +41,17 @@ SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
a
a
1
1
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1( a INT );
SELECT b FROM t1;
ERROR 42S22: Unknown column 'b' in 'field list'
SHOW ERRORS;
Level Code Message
Error 1054 Unknown column 'b' in 'field list'
CREATE TABLE t2 SELECT b FROM t1;
ERROR 42S22: Unknown column 'b' in 'field list'
SHOW ERRORS;
Level Code Message
Error 1054 Unknown column 'b' in 'field list'
INSERT INTO t1 SELECT b FROM t1;
ERROR 42S22: Unknown column 'b' in 'field list'
DROP TABLE t1;
mysql-test/t/errors.test
View file @
b728d0a6
...
@@ -53,4 +53,17 @@ INSERT INTO t1 VALUES(2),(3);
...
@@ -53,4 +53,17 @@ INSERT INTO t1 VALUES(2),(3);
SELECT
a
FROM
t1
WHERE
a
IN
(
1
,
(
SELECT
IF
(
1
=
0
,
1
,
2
/
0
)));
SELECT
a
FROM
t1
WHERE
a
IN
(
1
,
(
SELECT
IF
(
1
=
0
,
1
,
2
/
0
)));
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug #28677: SELECT on missing column gives extra error
#
CREATE
TABLE
t1
(
a
INT
);
--
error
ER_BAD_FIELD_ERROR
SELECT
b
FROM
t1
;
SHOW
ERRORS
;
--
error
ER_BAD_FIELD_ERROR
CREATE
TABLE
t2
SELECT
b
FROM
t1
;
SHOW
ERRORS
;
--
error
ER_BAD_FIELD_ERROR
INSERT
INTO
t1
SELECT
b
FROM
t1
;
DROP
TABLE
t1
;
# End of 5.0 tests
# End of 5.0 tests
sql/sql_class.h
View file @
b728d0a6
...
@@ -1959,6 +1959,7 @@ class select_insert :public select_result_interceptor {
...
@@ -1959,6 +1959,7 @@ class select_insert :public select_result_interceptor {
virtual
void
store_values
(
List
<
Item
>
&
values
);
virtual
void
store_values
(
List
<
Item
>
&
values
);
void
send_error
(
uint
errcode
,
const
char
*
err
);
void
send_error
(
uint
errcode
,
const
char
*
err
);
bool
send_eof
();
bool
send_eof
();
void
abort
();
/* not implemented: select_insert is never re-used in prepared statements */
/* not implemented: select_insert is never re-used in prepared statements */
void
cleanup
();
void
cleanup
();
};
};
...
...
sql/sql_insert.cc
View file @
b728d0a6
...
@@ -2892,41 +2892,6 @@ void select_insert::send_error(uint errcode,const char *err)
...
@@ -2892,41 +2892,6 @@ void select_insert::send_error(uint errcode,const char *err)
my_message
(
errcode
,
err
,
MYF
(
0
));
my_message
(
errcode
,
err
,
MYF
(
0
));
if
(
!
table
)
{
/*
This can only happen when using CREATE ... SELECT and the table was not
created becasue of an syntax error
*/
DBUG_VOID_RETURN
;
}
if
(
!
thd
->
prelocked_mode
)
table
->
file
->
end_bulk_insert
();
/*
If at least one row has been inserted/modified and will stay in the table
(the table doesn't have transactions) (example: we got a duplicate key
error while inserting into a MyISAM table) we must write to the binlog (and
the error code will make the slave stop).
*/
if
((
info
.
copied
||
info
.
deleted
||
info
.
updated
)
&&
!
table
->
file
->
has_transactions
())
{
if
(
last_insert_id
)
thd
->
insert_id
(
last_insert_id
);
// For binary log
if
(
mysql_bin_log
.
is_open
())
{
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
table
->
file
->
has_transactions
(),
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
if
(
!
table
->
s
->
tmp_table
)
thd
->
no_trans_update
.
all
=
TRUE
;
}
if
(
info
.
copied
||
info
.
deleted
||
info
.
updated
)
{
query_cache_invalidate3
(
thd
,
table
,
1
);
}
ha_rollback_stmt
(
thd
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -2984,6 +2949,49 @@ bool select_insert::send_eof()
...
@@ -2984,6 +2949,49 @@ bool select_insert::send_eof()
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
void
select_insert
::
abort
()
{
DBUG_ENTER
(
"select_insert::abort"
);
if
(
!
table
)
{
/*
This can only happen when using CREATE ... SELECT and the table was not
created becasue of an syntax error
*/
DBUG_VOID_RETURN
;
}
if
(
!
thd
->
prelocked_mode
)
table
->
file
->
end_bulk_insert
();
/*
If at least one row has been inserted/modified and will stay in the table
(the table doesn't have transactions) (example: we got a duplicate key
error while inserting into a MyISAM table) we must write to the binlog (and
the error code will make the slave stop).
*/
if
((
info
.
copied
||
info
.
deleted
||
info
.
updated
)
&&
!
table
->
file
->
has_transactions
())
{
if
(
last_insert_id
)
thd
->
insert_id
(
last_insert_id
);
// For binary log
if
(
mysql_bin_log
.
is_open
())
{
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
table
->
file
->
has_transactions
(),
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
if
(
!
table
->
s
->
tmp_table
)
thd
->
no_trans_update
.
all
=
TRUE
;
}
if
(
info
.
copied
||
info
.
deleted
||
info
.
updated
)
{
query_cache_invalidate3
(
thd
,
table
,
1
);
}
ha_rollback_stmt
(
thd
);
DBUG_VOID_RETURN
;
}
/***************************************************************************
/***************************************************************************
CREATE TABLE (SELECT) ...
CREATE TABLE (SELECT) ...
...
@@ -3241,13 +3249,7 @@ void select_create::store_values(List<Item> &values)
...
@@ -3241,13 +3249,7 @@ void select_create::store_values(List<Item> &values)
void
select_create
::
send_error
(
uint
errcode
,
const
char
*
err
)
void
select_create
::
send_error
(
uint
errcode
,
const
char
*
err
)
{
{
/*
Disable binlog, because we "roll back" partial inserts in ::abort
by removing the table, even for non-transactional tables.
*/
tmp_disable_binlog
(
thd
);
select_insert
::
send_error
(
errcode
,
err
);
select_insert
::
send_error
(
errcode
,
err
);
reenable_binlog
(
thd
);
}
}
...
@@ -3272,6 +3274,14 @@ bool select_create::send_eof()
...
@@ -3272,6 +3274,14 @@ bool select_create::send_eof()
void
select_create
::
abort
()
void
select_create
::
abort
()
{
{
/*
Disable binlog, because we "roll back" partial inserts in ::abort
by removing the table, even for non-transactional tables.
*/
tmp_disable_binlog
(
thd
);
select_insert
::
abort
();
reenable_binlog
(
thd
);
if
(
lock
)
if
(
lock
)
{
{
mysql_unlock_tables
(
thd
,
lock
);
mysql_unlock_tables
(
thd
,
lock
);
...
...
sql/sql_select.cc
View file @
b728d0a6
...
@@ -258,11 +258,8 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
...
@@ -258,11 +258,8 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
thd
->
net
.
report_error
));
thd
->
net
.
report_error
));
res
|=
thd
->
net
.
report_error
;
res
|=
thd
->
net
.
report_error
;
if
(
unlikely
(
res
))
if
(
unlikely
(
res
))
{
/* If we had a another error reported earlier then this will be ignored */
result
->
send_error
(
ER_UNKNOWN_ERROR
,
ER
(
ER_UNKNOWN_ERROR
));
result
->
abort
();
result
->
abort
();
}
DBUG_RETURN
(
res
);
DBUG_RETURN
(
res
);
}
}
...
...
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