summaryrefslogtreecommitdiff
path: root/mysql-test/r/cast.result
Commit message (Collapse)AuthorAgeFilesLines
* Create 'main' test directory and move 't' and 'r' thereMichael Widenius2018-03-291-1279/+0
|
* MDEV-14376 Explicit CAST(CHAR(N)) erroneously escalates warnings to errors ↵Alexander Barkov2017-11-131-0/+109
| | | | in STRICT_ALL_TABLES
* Fixing a few problems with data type and metadata for INT result functions ↵Alexander Barkov2017-05-231-1/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (MDEV-12852, MDEV-12853, MDEV-12869) This is a joint patch for: MDEV-12852 Out-of-range errors when CAST(1-2 AS UNSIGNED MDEV-12853 Out-of-range errors when CAST('-1' AS UNSIGNED MDEV-12869 Wrong metadata for integer additive and multiplicative operators 1. Fixing all Item_func_numhybrid descendants to set the precise data type handler (type_handler_long or type_handler_longlong) at fix_fields() time. This fixes MDEV-12869. 2. Fixing Item_func_unsigned_typecast to set the precise data type handler at fix_fields() time. This fixes MDEV-12852 and MDEV-12853. This is done by: - fixing Type_handler::Item_func_unsigned_fix_length_and_dec() and Type_handler_string_result::Item_func_unsigned_fix_length_and_dec() to properly detect situations when a negative epxression is converted to UNSIGNED. In this case, length of the result is now always set to MAX_BIGINT_WIDTH without trying to use args[0]->max_length, as very short arguments can produce very long result in such conversion: CAST(-1 AS UNSIGNED) -> 18446744073709551614 - adding a new virtual method "longlong Item::val_int_max() const", to preserve the old behavior for expressions like this: CAST(1 AS UNSIGNED) to stay under the INT data type (instead of BIGINT) for small positive integer literals. Using Item::unsigned_flag would not help, because Item_int does not set unsigned_flag to "true" for positive numbers. 3. Adding helper methods: * Item::type_handler_long_or_longlong() * Type_handler::type_handler_long_or_longlong() and reusing them in a few places, to reduce code duplication. 4. Making reorganation in create_tmp_field() and create_field_for_create_select() for Item_hybrid_func and descendants, to reduce duplicate code. They all now have a similar behavior in respect of creating fields. Only Item_func_user_var descendants have a different behavior. So moving the default behvior to Item_hybrid_func, and overriding behavior on Item_func_user_var level.
* An after-fix for MDEV-12849 Out-of-range errors when casting hex-hybrid to ↵Alexander Barkov2017-05-191-2/+4
| | | | | | | | | | | SIGNED and UNSIGNED 1. Adding the forgotten "SET sql_mode=STRICT_ALL_TABLES" into the test. 2. STRICT_ALL_TABLES revealed that CAST(0xFFFFFFFF AS SIGNED), e.g. with a hex number with 8 hex digits, did not work well. Fixing Item_func_unsigned::create_tmp_field() and Item_func_unsigned::create_field_for_create_select() to handle this corner case.
* MDEV-12849 Out-of-range errors when casting hex-hybrid to SIGNED and UNSIGNEDAlexander Barkov2017-05-191-0/+228
|
* MDEV-7635: Update tests to adapt to the new default sql_modeNirbhay Choubey2017-02-101-3/+10
|
* Merge 10.1 to 10.2.Marko Mäkelä2017-01-191-1/+72
|\ | | | | | | | | | | | | | | | | Most notably, this includes MDEV-11623, which includes a fix and an upgrade procedure for the InnoDB file format incompatibility that is present in MariaDB Server 10.1.0 through 10.1.20. In other words, this merge should address MDEV-11202 InnoDB 10.1 -> 10.2 migration does not work
| * MDEV-11030 Assertion `precision > 0' failed in decimal_bin_sizeAlexander Barkov2017-01-121-1/+72
| | | | | | | | | | | | | | | | | | | | | | Fixing Item::decimal_precision() to return at least one digit. This fixes the problem reported in MDEV. Also, fixing Item_func_signed::fix_length_and_dec() to reserve space for at least one digit (plus one character for an optional sign). This is needed to have CONVERT(expr,SIGNED) and CONVERT(expr,UNSIGNED) create correct string fields when they appear in string context, e.g.: CREATE TABLE t1 AS SELECT CONCAT(CONVERT('',SIGNED));
* | Item::print(): remove redundant parenthesesSergei Golubchik2016-12-121-2/+2
| | | | | | | | | | by introducing new Item::precedence() method and using it to decide whether parentheses are required
* | MDEV-11066 use MySQL terminology for "virtual columns"Sergei Golubchik2016-12-121-1/+1
| |
* | store/show vcols as item->print()Sergei Golubchik2016-12-121-1/+1
| | | | | | | | | | | | | | | | | | | | otherwise we'd need to store sql_mode *per vcol* (consider CREATE INDEX...) and how SHOW CREATE TABLE would support that? Additionally, get rid of vcol::expr_str, just to make sure the string is always generated and never leaked in the original form.
* | Remove end . from error messages to get them consistentMonty2016-10-051-8/+8
| | | | | | | | Fixed a few failing tests
* | Removing duplicate code in double-to-longlong conversion.Alexander Barkov2016-07-031-2/+2
| | | | | | | | | | | | | | | | | | | | Adding Converter_double_to_longlong and reusing it in: 1. Field_longlong::store(double nr) 2. Field_double::val_int() 3. Item::val_int_from_real() 4. Item_dyncol_get::val_int() As a good side efferct, now overflow in conversion in the mentioned val_xxx() methods return exactly the same warning.
* | MDEV-10138 Support for decimals up to 38 digitsMonty2016-06-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Decimals with float, double and decimal now works the following way: - DECIMAL_NOT_SPECIFIED is used when declaring DECIMALS without a firm number of decimals. It's only used in asserts and my_decimal_int_part. - FLOATING_POINT_DECIMALS (31) is used to mark that a FLOAT or DOUBLE was defined without decimals. This is regarded as a floating point value. - Max decimals allowed for FLOAT and DOUBLE is FLOATING_POINT_DECIMALS-1 - Clients assumes that float and double with decimals >= NOT_FIXED_DEC are floating point values (no decimals) - In the .frm decimals=FLOATING_POINT_DECIMALS are used to define floating point for float and double (31, like before) To ensure compatibility with old clients we do: - When storing float and double, we change NOT_FIXED_DEC to FLOATING_POINT_DECIMALS. - When creating fields from .frm we change for float and double FLOATING_POINT_DEC to NOT_FIXED_DEC - When sending definition for a float/decimal field without decimals to the client as part of a result set we convert NOT_FIXED_DEC to FLOATING_POINT_DECIMALS. - variance() and std() has changed to limit the decimals to FLOATING_POINT_DECIMALS -1 to not get the double converted floating point. (This was to preserve compatiblity) - FLOAT and DOUBLE still have 30 as max number of decimals. Bugs fixed: variance() printed more decimals than we support for double values. New behaviour: - Strings now have 38 decimals instead of 30 when converted to decimal - CREATE ... SELECT with a decimal with > 30 decimals will create a column with a smaller range than before as we are trying to preserve the number of decimals. Other changes - We are now using the obsolete bit FIELDFLAG_LEFT_FULLSCREEN to specify decimals > 31 - NOT_FIXED_DEC is now declared in one place - For clients, NOT_FIXED_DEC is always 31 (to ensure compatibility). On the server NOT_FIXED_DEC is DECIMAL_NOT_SPECIFIED (39) - AUTO_SEC_PART_DIGITS is taken from DECIMAL_NOT_SPECIFIED - DOUBLE conversion functions are now using DECIMAL_NOT_SPECIFIED instead of NOT_FIXED_DEC
* | MDEV-6720 - enable connection log in mysqltest by defaultSergey Vojtovich2016-03-311-0/+3
|/
* MDEV-8466 CAST works differently for DECIMAL/INT vs DOUBLE for empty stringsAlexander Barkov2015-09-171-1/+1
| | | | MDEV-8468 CAST and INSERT work differently for DECIMAL/INT vs DOUBLE for a string with trailing spaces
* Ensure that fields declared with NOT NULL doesn't have DEFAULT values if not ↵Monty2015-08-181-18/+18
| | | | | | | | | | | | | | | | | | specified and if not timestamp or auto_increment In original code, sometimes one got an automatic DEFAULT value in some cases, in other cases not. For example: create table t1 (a int primary key) - No default create table t2 (a int, primary key(a)) - DEFAULT 0 create table t1 SELECT .... - Default for all fields, even if they where defined as NOT NULL ALTER TABLE ... MODIFY could sometimes add an unexpected DEFAULT value. The patch is quite big because we had some many test cases that used CREATE ... SELECT or CREATE ... (...PRIMARY KEY(xxx)) which doesn't have an automatic DEFAULT anymore. Other things: - Removed warnings from InnoDB when waiting from semaphore (got this when testing things with --big)
* MDEV-7661 Unexpected result for: CAST(0xHHHH AS CHAR CHARACTER SET xxx)Alexander Barkov2015-03-181-4/+4
| | | | for incorrect byte sequences
* parser cleanup: don't store field properties in LEX, use Create_field directlySergei Golubchik2014-12-041-0/+23
| | | | | | | | | | | length/dec/charset are still in LEX, because they're also used for CAST and dynamic columns. also 1. fix "MDEV-7041 COLLATION(CAST('a' AS CHAR BINARY)) returns a wrong result" 2. allow BINARY modifier in stored function RETURN clause 3. allow "COLLATION without CHARSET" in SP/SF (parameters, RETURN, DECLARE) 4. print correct variable name in error messages for stored routine parameters
* 5.5.38 mergeSergei Golubchik2014-06-061-8/+8
|\
| * Merge 5.3->5.5Alexander Barkov2014-06-041-8/+8
| |\
| | * MDEV-4858 Wrong results for a huge unsigned value inserted into a TIME columnAlexander Barkov2014-06-041-8/+8
| | | | | | | | | | | | | | | | | | | | | MDEV-6099 Bad results for DATE_ADD(.., INTERVAL 2000000000000000000.0 SECOND) MDEV-6097 Inconsistent results for CAST(int,decimal,double AS DATETIME) MDEV-6100 No warning on CAST(9000000 AS TIME)
| | * 5.2 mergeSergei Golubchik2014-03-161-0/+18
| | |\
* | | | MDEV-5372 Make "CAST(time_expr AS DATETIME)" compatible with MySQL-5.6 (and ↵Alexander Barkov2014-03-071-8/+5
| | | | | | | | | | | | | | | | the SQL Standard)
* | | | 10.0-base merge.Sergei Golubchik2013-09-211-1/+1
|\ \ \ \ | |/ / / | | | | | | | | | | | | Partitioning/InnoDB changes are *not* merged (they'll come from 5.6) TokuDB does not compile (not updated to 10.0 SE API)
* | | | 10.0-monty mergeSergei Golubchik2013-07-211-3/+9
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | includes: * remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING" * introduce LOCK_share, now LOCK_ha_data is strictly for engines * rea_create_table() always creates .par file (even in "frm-only" mode) * fix a 5.6 bug, temp file leak on dummy ALTER TABLE
| * | | | fix cast.test, select.test, select_jcl6.test: update results after ↵Sergei Golubchik2013-07-101-3/+9
| | | | | | | | | | | | | | | | | | | | strict_date_checking=1
* | | | | 10.0-base mergeSergei Golubchik2013-07-181-11/+17
|\ \ \ \ \ | | |/ / / | |/| | |
| * | | | Merging from 5.3Alexander Barkov2013-07-081-11/+17
| |\ \ \ \ | | | |/ / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | modified: include/my_time.h libmysql/libmysql.c mysql-test/r/adddate_454.result mysql-test/r/cast.result mysql-test/r/date_formats.result mysql-test/r/func_sapdb.result mysql-test/r/func_time.result mysql-test/r/mdev316.result mysql-test/r/parser.result mysql-test/r/partition_datatype.result mysql-test/r/partition_pruning.result mysql-test/r/type_date.result mysql-test/r/type_datetime.result mysql-test/suite/vcol/r/vcol_misc.result mysql-test/t/cast.test sql-common/my_time.c sql/field.cc sql/field_conv.cc sql/filesort.cc sql/item.cc sql/item.h sql/item_cmpfunc.cc sql/item_func.cc sql/item_strfunc.cc sql/item_timefunc.cc sql/sql_time.cc pending merges: Sergei Golubchik 2013-07-03 MDEV-4667 DATE('string') incompability betwe...
| | * | | MDEV-4667 DATE('string') incompability between mysql and mariadbSergei Golubchik2013-07-031-11/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cleanup: remove TIME_FUZZY_DATE. Introduce TIME_FUZZY_DATES which means "very fuzzy, the resulting value is only used for comparison. It can be invalid date, fine, as long as it can be compared". Updated many tests results (they're better now).
* | | | | Adding support for the SQL-standard temporal literals.Alexander Barkov2013-07-101-10/+10
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | added: mysql-test/r/temporal_literal.result mysql-test/t/temporal_literal.test modified: client/mysqlbinlog.cc include/my_time.h mysql-test/r/cast.result mysql-test/r/partition_innodb.result mysql-test/t/cast.test mysql-test/t/partition_innodb.test sql-common/my_time.c sql/field.cc sql/item.cc sql/item.h sql/item_cmpfunc.cc sql/item_create.cc sql/item_create.h sql/item_strfunc.cc sql/item_timefunc.cc sql/item_timefunc.h sql/sql_select.cc sql/sql_time.cc sql/sql_time.h sql/sql_yacc.yy storage/spider/spd_db_mysql.cc
* | | | mysql-5.5.31 mergeSergei Golubchik2013-05-071-0/+18
|\ \ \ \
| * \ \ \ Bug#14096619: UNABLE TO RESTORE DATABASE DUMPChaithra Gopalareddy2013-01-311-0/+18
| |\ \ \ \ | | | |_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport of fix for Bug#13581962 mysql-test/r/cast.result: Added test result for Bug#13581962,Bug#14096619 mysql-test/r/ctype_utf8mb4.result: Added test result for Bug#13581962,Bug#14096619 mysql-test/t/cast.test: Added test case for Bug#13581962,Bug#14096619 mysql-test/t/ctype_utf8mb4.test: Added test case for Bug#13581962,Bug#14096619 sql/item_func.h: limit max length by MY_INT64_NUM_DECIMAL_DIGITS
| | * | | Bug#14096619: UNABLE TO RESTORE DATABASE DUMPChaithra Gopalareddy2013-01-311-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport of Bug#13581962 mysql-test/r/cast.result: Added test result for Bug#13581962,Bug#14096619 mysql-test/t/cast.test: Added test case for Bug#13581962,Bug#14096619 sql/item_func.h: limit max length by MY_INT64_NUM_DECIMAL_DIGITS
* | | | | 5.3 mergeSergei Golubchik2013-03-271-10/+10
|\ \ \ \ \ | | |_|/ / | |/| | / | |_|_|/ |/| | |
| * | | MDEV-4281 Assertion `maybe_null && item->null_value' fails in make_sortkey ↵Sergei Golubchik2013-03-171-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | on CASE with different return types, GROUP_CONCAT, GROUP BY Fix Item::get_date() to mark the item NULL when returning an error.
| * | | 5.2 mergeSergei Golubchik2012-05-201-0/+9
| |\ \ \ | | | |/ | | |/|
* | | | cSergei Golubchik2012-05-211-0/+9
|\ \ \ \ | | |_|/ | |/| |
| * | | Merge 5.1-security => 5.5-securityTor Didriksen2012-02-221-0/+9
| |\ \ \ | | | |/ | | |/|
| | * | Bug#13519724 63793: CRASH IN DTCOLLATION::SET(DTCOLLATION &SET)Tor Didriksen2012-02-221-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Backport of fix for: Bug#53236 Segfault in DTCollation::set(DTCollation&)
* | | | 5.3 mergeSergei Golubchik2012-01-131-2/+7
|\ \ \ \ | | |_|/ | |/| |
| * | | Merge with 5.2.Michael Widenius2011-12-111-0/+18
| |\ \ \ | | | |/ | | |/| | | | | no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
* | | | after merge changes:Sergei Golubchik2011-12-121-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * rename all debugging related command-line options and variables to start from "debug-", and made them all OFF by default. * replace "MySQL" with "MariaDB" in error messages * "Cast ... converted ... integer to it's ... complement" is now a note, not a warning * @@query_cache_strip_comments now has a session scope, not global.
* | | | 5.3->5.5 mergeSergei Golubchik2011-11-221-3/+8
|\ \ \ \ | |/ / /
| * | | cast.test: use exact double, to be independent from compiler optimizationsSergei Golubchik2011-11-031-3/+3
| | | |
| * | | make sure that cast(... as date) returns a valid date, as specified by the ↵Sergei Golubchik2011-09-291-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | caller. make Item::send() request a date according to the current SQL mode limitations.
* | | | merge with 5.3Sergei Golubchik2011-10-191-7/+288
|\ \ \ \ | |/ / / | | | / | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | sql/sql_insert.cc: CREATE ... IF NOT EXISTS may do nothing, but it is still not a failure. don't forget to my_ok it. ****** CREATE ... IF NOT EXISTS may do nothing, but it is still not a failure. don't forget to my_ok it. sql/sql_table.cc: small cleanup ****** small cleanup
| * | fix for cast of negative numbers to datetimeSergei Golubchik2011-06-141-1/+1
| | |
| * | merge with 5.1-microSergei Golubchik2011-06-071-14/+12
| |\ \
| * \ \ Merge with 5.1-microsecondsMichael Widenius2011-05-281-13/+108
| |\ \ \ | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A lot of small fixes and new test cases. client/mysqlbinlog.cc: Cast removed client/mysqltest.cc: Added missing DBUG_RETURN include/my_pthread.h: set_timespec_time_nsec() now only takes one argument mysql-test/t/date_formats.test: Remove --disable_ps_protocl as now also ps supports microseconds mysys/my_uuid.c: Changed to use my_interval_timer() instead of my_getsystime() mysys/waiting_threads.c: Changed to use my_hrtime() sql/field.h: Added bool special_const_compare() for fields that may convert values before compare (like year) sql/field_conv.cc: Added test to get optimal copying of identical temporal values. sql/item.cc: Return that item_int is equal if it's positive, even if unsigned flag is different. Fixed Item_cache_str::save_in_field() to have identical null check as other similar functions Added proper NULL check to Item_cache_int::save_in_field() sql/item_cmpfunc.cc: Don't call convert_constant_item() if there is nothing that is worth converting. Simplified test when years should be converted sql/item_sum.cc: Mark cache values in Item_sum_hybrid as not constants to ensure they are not replaced by other cache values in compare_datetime() sql/item_timefunc.cc: Changed sec_to_time() to take a my_decimal argument to ensure we don't loose any sub seconds. Added Item_temporal_func::get_time() (This simplifies some things) sql/mysql_priv.h: Added Lazy_string_decimal() sql/mysqld.cc: Added my_decimal constants max_seconds_for_time_type, time_second_part_factor sql/table.cc: Changed expr_arena to be of type CONVENTIONAL_EXECUTION to ensure that we don't loose any items that are created by fix_fields() sql/tztime.cc: TIME_to_gmt_sec() now sets *in_dst_time_gap in case of errors This is needed to be able to detect if timestamp is 0 storage/maria/lockman.c: Changed from my_getsystime() to set_timespec_time_nsec() storage/maria/ma_loghandler.c: Changed from my_getsystime() to my_hrtime() storage/maria/ma_recovery.c: Changed from my_getsystime() to mmicrosecond_interval_timer() storage/maria/unittest/trnman-t.c: Changed from my_getsystime() to mmicrosecond_interval_timer() storage/xtradb/handler/ha_innodb.cc: Added support for new time,datetime and timestamp unittest/mysys/thr_template.c: my_getsystime() -> my_interval_timer() unittest/mysys/waiting_threads-t.c: my_getsystime() -> my_interval_timer()