mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-24 07:13:33 +03:00 
			
		
		
		
	CAST() now produces warnings when casting a wrong INTEGER or CHAR values. This also applies to implicite string to number casts. (Bug #5912) ALTER TABLE now fails in STRICT mode if it generates warnings. Inserting a zero date in a DATE, DATETIME or TIMESTAMP column during TRADITIONAL mode now produces an error. (Bug #5933) mysql-test/r/bigint.result: New warning added mysql-test/r/cast.result: Added testing of wrong CAST's of strings to numbers and numbers to strings mysql-test/r/create.result: Added test for wrong default values (#5902) mysql-test/r/func_if.result: Changed tests to produce less warnings mysql-test/r/func_misc.result: New warning mysql-test/r/func_str.result: Added missing drop table Changed test to produce less warnings New warnings mysql-test/r/ndb_index_unique.result: Removed wrong default usage mysql-test/r/ps_1general.result: Changed tests to produce less warnings mysql-test/r/row.result: New warnings mysql-test/r/rpl_session_var.result: Changed tests to produce less warnings mysql-test/r/strict.result: New tests for CAST() and zero date handling mysql-test/r/subselect.result: Changed tests to produce less warnings mysql-test/r/type_ranges.result: Changed tests to produce less warnings mysql-test/t/cast.test: Added testing of wrong CAST's of strings to numbers and numbers to strings mysql-test/t/create.test: Added test for wrong default values (#5902) mysql-test/t/func_if.test: Changed tests to produce less warnings mysql-test/t/func_str.test: Added missing drop table Changed test to produce less warnings New warnings mysql-test/t/ndb_index_unique.test: Removed wrong default usage mysql-test/t/ps_1general.test: Changed tests to produce less warnings mysql-test/t/rpl_session_var.test: Changed tests to produce less warnings mysql-test/t/strict.test: New tests for CAST() and zero date handling mysql-test/t/subselect.test: Changed tests to produce less warnings mysql-test/t/type_ranges.test: Changed tests to produce less warnings sql/Makefile.am: Added new include file sql/field.cc: Added warnings for zero dates for DATE, DATETIME and TIMESTAMP Moved Field_blob::max_length() to a more appropriate position Changed type for 'level' in set_warning() to avoid casts sql/field.h: Changed type for 'level' in set_warning() to avoid casts sql/field_conv.cc: Copy date and datetime fields through string in 'traditional' mode to detect zero dates sql/item.cc: Removed compiler warnings Give warnings for wrong CAST of strings -> number sql/item.h: Moved Item_string::val_real() and ::val_int() to item.cc sql/item_row.cc: Better detection of null values (which doesn't produce warnings) sql/item_sum.cc: Better detection of null values (which doesn't produce warnings) sql/item_timefunc.cc: Give warnings for wrong CAST of number -> string sql/my_decimal.cc: Fixed typo in comment sql/mysql_priv.h: Removed prototype for static function Moved defines for error handling to sql_error.h (to be able to use these in field.h) sql/mysqld.cc: Simplify code sql/sql_class.h: Moved to sql_error.h sql/sql_load.cc: Removed wrong cast sql/sql_parse.cc: Fixed wrong printf() sql/sql_table.cc: Made mysql_prepare_table() static Changed references to pointers to make code more readable ALTER TABLE now aborts if one gets warnings in STRICT mode sql/time.cc: Fixed possible wrong call sql/unireg.cc: Removed one call to current_thd Give errors if one uses a wrong DEFAULT value
		
			
				
	
	
		
			54 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| select format(1.5555,0),format(123.5555,1),format(1234.5555,2),format(12345.55555,3),format(123456.5555,4),format(1234567.5555,5),format("12345.2399",2);
 | |
| format(1.5555,0)	format(123.5555,1)	format(1234.5555,2)	format(12345.55555,3)	format(123456.5555,4)	format(1234567.5555,5)	format("12345.2399",2)
 | |
| 2	123.6	1,234.56	12,345.556	123,456.5555	1,234,567.55550	12,345.24
 | |
| select inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"));
 | |
| inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"))
 | |
| NULL
 | |
| select inet_aton("255.255.255.255.255"),inet_aton("255.255.1.255"),inet_aton("0.1.255");
 | |
| inet_aton("255.255.255.255.255")	inet_aton("255.255.1.255")	inet_aton("0.1.255")
 | |
| 1099511627775	4294902271	65791
 | |
| select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
 | |
| inet_ntoa(1099511627775)	inet_ntoa(4294902271)	inet_ntoa(511)
 | |
| NULL	255.255.1.255	0.0.1.255
 | |
| select hex(inet_aton('127'));
 | |
| hex(inet_aton('127'))
 | |
| 7F
 | |
| select hex(inet_aton('127.1'));
 | |
| hex(inet_aton('127.1'))
 | |
| 7F000001
 | |
| select hex(inet_aton('127.1.1'));
 | |
| hex(inet_aton('127.1.1'))
 | |
| 7F010001
 | |
| select length(uuid()), charset(uuid()), length(unhex(replace(uuid(),_utf8'-',_utf8'')));
 | |
| length(uuid())	charset(uuid())	length(unhex(replace(uuid(),_utf8'-',_utf8'')))
 | |
| 36	utf8	16
 | |
| select length(format('nan', 2)) > 0;
 | |
| length(format('nan', 2)) > 0
 | |
| 1
 | |
| Warnings:
 | |
| Warning	1292	Truncated incorrect DOUBLE value: 'nan'
 | |
| select concat("$",format(2500,2));
 | |
| concat("$",format(2500,2))
 | |
| $2,500.00
 | |
| create table t1 ( a timestamp );
 | |
| insert into t1 values ( '2004-01-06 12:34' );
 | |
| select a from t1 where left(a+0,6) in ( left(20040106,6) );
 | |
| a
 | |
| 2004-01-06 12:34:00
 | |
| select a from t1 where left(a+0,6) = ( left(20040106,6) );
 | |
| a
 | |
| 2004-01-06 12:34:00
 | |
| select a from t1 where right(a+0,6) in ( right(20040106123400,6) );
 | |
| a
 | |
| 2004-01-06 12:34:00
 | |
| select a from t1 where right(a+0,6) = ( right(20040106123400,6) );
 | |
| a
 | |
| 2004-01-06 12:34:00
 | |
| select a from t1 where mid(a+0,6,3) in ( mid(20040106123400,6,3) );
 | |
| a
 | |
| 2004-01-06 12:34:00
 | |
| select a from t1 where mid(a+0,6,3) = ( mid(20040106123400,6,3) );
 | |
| a
 | |
| 2004-01-06 12:34:00
 | |
| drop table t1;
 |