mariadb/mysql-test/r/compare.result
unknown 9221a5482b BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
When implicitly converting string fields to numbers the 
 string-to-number conversion error was not sent to the client.
 Added code to send the conversion error as warning.
 
 We also need to prevent generation of warnings from the places
 where val_xxx() methods are called for the sole purpose of updating
 the Item::null_value flag.
 To achieve that a special function is added (and called) : 
 update_null_value(). This function will set the no_errors flag and
 will call val_xxx(). The warning generation in Field_string::val_xxx()
 will use the flag when generating the conversion warnings. 


mysql-test/r/compare.result:
  BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
   - non-convertible strings in arithmetic operations
mysql-test/r/func_gconcat.result:
  BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
   - non-convertible strings in arithmetic operations
mysql-test/r/func_group.result:
  BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
   - non-convertible strings in arithmetic operations
mysql-test/r/type_varchar.result:
  BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
   - test case
mysql-test/t/type_varchar.test:
  BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
   - test case
sql/field.cc:
  BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
   - send conversion warning to the client
sql/item.cc:
  BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
   - send conversion warning to the client
sql/item.h:
  BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
   - added a special function to explicitly update the null_value
sql/item_func.h:
  BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
   - added a special function to explicitly update the null_value
sql/item_subselect.h:
  BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
   - added a special function to explicitly update the null_value
sql/item_sum.cc:
  BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
   - added a special function to explicitly update the null_value
sql/item_sum.h:
  BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
   - added a special function to explicitly update the null_value
sql/sql_string.h:
  BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
   - send conversion warning to the client
2006-11-28 15:44:11 +02:00

55 lines
1.3 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

drop table if exists t1;
CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id));
insert into t1 values ('000000000001'),('000000000002');
explain select * from t1 where id=000000000001;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 12 NULL 2 Using where; Using index
select * from t1 where id=000000000001;
id
000000000001
delete from t1 where id=000000000002;
select * from t1;
id
000000000001
drop table t1;
SELECT 'a' = 'a ';
'a' = 'a '
1
SELECT 'a\0' < 'a';
'a\0' < 'a'
1
SELECT 'a\0' < 'a ';
'a\0' < 'a '
1
SELECT 'a\t' < 'a';
'a\t' < 'a'
1
SELECT 'a\t' < 'a ';
'a\t' < 'a '
1
CREATE TABLE t1 (a char(10) not null);
INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
hex(a) STRCMP(a,'a') STRCMP(a,'a ')
61 0 0
6100 -1 -1
6109 -1 -1
61 0 0
DROP TABLE t1;
SELECT CHAR(31) = '', '' = CHAR(31);
CHAR(31) = '' '' = CHAR(31)
0 0
SELECT CHAR(30) = '', '' = CHAR(30);
CHAR(30) = '' '' = CHAR(30)
0 0
create table t1 (a tinyint(1),b binary(1));
insert into t1 values (0x01,0x01);
select * from t1 where a=b;
a b
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
select * from t1 where a=b and b=0x01;
a b
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
drop table if exists t1;