List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:June 18 2007 2:11pm
Subject:Re: bk commit into 5.0 tree (mhansson:1.2498) BUG#28677
View as plain text  
* mhansson@stripped <mhansson@stripped> [07/06/18 17:55]:

> ChangeSet@stripped, 2007-06-18 15:32:05+03:00, mhansson@stripped +5 -0
>   Bug#28677: SELECT on missing column gives extra error
>   
>   The method select_insert::send_error does two things, it rolls
>   back a statement being executed and outputs an error message.
>   But when a nonexistent column is referenced, an error message
>   has been published already and there is no need to publish
>   another.  Fixed by moving all functionality beyond publishing
>   an error message into select_insert::abort() and calling only
>   that function.

The patch is OK to push, but see below.

>  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)
> 
> --- 1.11/mysql-test/r/errors.result	2007-04-04 13:38:18 +03:00
> +++ 1.12/mysql-test/r/errors.result	2007-06-18 15:32:03 +03:00
> @@ -41,3 +41,9 @@ SELECT a FROM t1 WHERE a IN(1, (SELECT I
>  a
>  1
>  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'
> 
> --- 1.17/mysql-test/t/errors.test	2007-04-04 13:38:18 +03:00
> +++ 1.18/mysql-test/t/errors.test	2007-06-18 15:32:03 +03:00
> @@ -53,4 +53,12 @@ INSERT INTO t1 VALUES(2),(3);
>  SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
>  DROP TABLE t1;
>  
> +#
> +# Bug #28677: SELECT on missing column gives extra error
> +#
> +CREATE TABLE t1( a INT );
> +--error 1054

Please use symbolic identifiers for errors in the test case.
You forgot to drop the table.

> +SELECT b FROM t1;
> +SHOW ERRORS;
> +

How about adding this test case: 

create table t1 a int;
create procedure bug_28677()
begin
  declare m_sql varchar(10);
  declare continue handler for 1054
    select concat("continue handler was called for ", p_sql) as 'Message';
  set m_sql="select";
  select b from t1;
  show errors;
  set m_sql="create ... select";
  create table t2 select b from t1;
  show errors;
  set m_sql="insert ... select";
  insert into t1 select b from t1;
  show errors;
end|

call p1()|
call p1()|
drop table t1;
drop procedure bug_28677()|

See also
http://bugs.mysql.com/bug.php?id=26432
Bug #26432 SELECT with an unknown column create an "Unknown
error" in SHOW ERRORS;

It should be closed as duplicate.

-- 
-- Konstantin Osipov              Software Developer, Moscow, Russia
-- MySQL AB, www.mysql.com   The best DATABASE COMPANY in the GALAXY
Thread
bk commit into 5.0 tree (mhansson:1.2498) BUG#28677mhansson18 Jun
  • Re: bk commit into 5.0 tree (mhansson:1.2498) BUG#28677Konstantin Osipov18 Jun