summaryrefslogtreecommitdiff
path: root/sql/field.h
Commit message (Collapse)AuthorAgeFilesLines
* move away from TIMESTAMP_DNUN_FIELD/TIMESTAMP_DN_FIELD codeSergei Golubchik2016-08-271-53/+2
| | | | | use the new approach with Field->default_value expressions. But keep the old TIMESTAMP_UN_FIELD for ON UPDATE NOW().
* optimize constant default expressionsSergei Golubchik2016-08-271-1/+5
| | | | | to be calculated at the CREATE TABLE time and stored in the default row image.
* vcol flag rename VCOL_UNKNOWN -> VCOL_FIELD_REFSergei Golubchik2016-08-271-1/+1
|
* session-state dependent functions in DEFAULT/CHECK/vcolsSergei Golubchik2016-08-271-3/+6
| | | | | | | | | | | | | | | | | * revert part of the db7edfe that moved calculations from fix_fields to val_str for Item_func_sysconst and descendants * mark session state dependent functions in check_vcol_func_processor() * re-run fix_fields for all such functions for every statement * fix CURRENT_USER/CURRENT_ROLE not to use Name_resolution_context (that is allocated on the stack in unpack_vcol_info_from_frm()) Note that NOW(), CURDATE(), etc use lazy initialization and do *not* force fix_fields to be re-run. The rule is: * lazy initialization is *not* allowed, if it changes metadata (so, e.g. DAYNAME() cannot use it) * lazy initialization is *preferrable* if it has side effects (e.g. NOW() sets thd->time_zone_used=1, so it's better to do it when the value of NOW is actually needed, not when NOW is simply prepared)
* Removing duplicate code in double-to-longlong conversion.Alexander Barkov2016-07-031-2/+36
| | | | | | | | | | 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.
* don't save vcol flags in frmSergei Golubchik2016-07-011-1/+1
| | | | | | this is useless now, flags are recalculated on load anyway. But storing flags on disk means we cannot easily change (add, remove, or renumber) them in the new MariaDB version.
* Merge branch '10.1' into 10.2Sergei Golubchik2016-06-301-13/+20
|\
| * Merge branch '10.0' into 10.1Sergei Golubchik2016-06-281-13/+15
| |\
| | * Merge branch '5.5' into bb-10.0Sergei Golubchik2016-06-211-13/+15
| | |\
| | | * MDEV-8402 Bug #77473 Truncated data with subquery & UTF8Alexander Barkov2016-06-101-4/+3
| | | |
| | | * MDEV-10181 Illegal mix of collation for a field and an ASCII string as a ↵Alexander Barkov2016-06-101-9/+12
| | | | | | | | | | | | | | | | view field
| * | | MDEV-8502 DECIMAL accepts out of range DEFAULT valuesAlexander Barkov2016-06-271-0/+5
| | | | | | | | | | | | | | | | MDEV-10277 Redundant NOTE when inserting '0.00001 ' into a DECIMAL(2,1) column
* | | | various cleanupsSergei Golubchik2016-06-301-16/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * remove a confusing method name - Field::set_default_expression() * remove handler::register_columns_for_write() * rename stuff * add asserts * remove unlikely unlikely * remove redundant if() conditions * fix mark_unsupported_function() to report the most important violation * don't scan vfield list for default values (vfields don't have defaults) * move handling for DROP CONSTRAINT IF EXIST where it belongs * don't protect engines from Alter_inplace_info::ALTER_ADD_CONSTRAINT * comments
* | | | change vcol->non_deterministic to vcol->flagsSergei Golubchik2016-06-301-3/+9
| | | |
* | | | Use default character set for expressionsMichael Widenius2016-06-301-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Force usage of () around complex DEFAULT expressions - Give error if DEFAULT expression contains invalid characters - Don't use const_charset_conversion for stored Item_func_sysconf expressions as the result is not constaint over different executions - Fixed Item_func_user() to not store calculated value in str_value
* | | | MDEV-7563 Support CHECK constraint as in (or close to) SQL StandardMichael Widenius2016-06-301-25/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-10134 Add full support for DEFAULT - Added support for using tables with MySQL 5.7 virtual fields, including MySQL 5.7 syntax - Better error messages also for old cases - CREATE ... SELECT now also updates timestamp columns - Blob can now have default values - Added new system variable "check_constraint_checks", to turn of CHECK constraint checking if needed. - Removed some engine independent tests in suite vcol to only test myisam - Moved some tests from 'include' to 't'. Should some day be done for all tests. - FRM version increased to 11 if one uses virtual fields or constraints - Changed to use a bitmap to check if a field has got a value, instead of setting HAS_EXPLICIT_VALUE bit in field flags - Expressions can now be up to 65K in total - Ensure we are not refering to uninitialized fields when handling virtual fields or defaults - Changed check_vcol_func_processor() to return a bitmap of used types - Had to change some functions that calculated cached value in fix_fields to do this in val() or getdate() instead. - store_now_in_TIME() now takes a THD argument - fill_record() now updates default values - Add a lookahead for NOT NULL, to be able to handle DEFAULT 1+1 NOT NULL - Automatically generate a name for constraints that doesn't have a name - Added support for ALTER TABLE DROP CONSTRAINT - Ensure that partition functions register virtual fields used. This fixes some bugs when using virtual fields in a partitioning function
* | | | MDEV-10138 Support for decimals up to 38 digitsMonty2016-06-221-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | fix most annoying warnings on WindowsVladislav Vaintroub2016-03-221-1/+1
| | | |
* | | | MDEV-9709 Unexpected modification of value and warning about out of range ↵Alexander Barkov2016-03-141-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | value upon ALTER MDEV-4102 Limitation on DOUBLE or REAL length is ignored with INSERT .. SELECT
* | | | Merge branch '10.1' into 10.2Sergei Golubchik2016-02-251-1/+8
|\ \ \ \ | |/ / /
| * | | Merge branch '10.0' into 10.1Sergei Golubchik2016-02-231-0/+7
| |\ \ \ | | |/ /
| | * | MDEV-9045 Inconsistent handling of "ALGORITHM=INPLACE" with PERSISTENT ↵Sergei Golubchik2016-02-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | generated columns Only set Alter_inplace_info::ALTER_COLUMN_VCOL flag if a vcol might be affected by the ALTER TABLE statement
* | | | MDEV-9393 Split Copy_field::get_copy_func() into virtual methods in FieldAlexander Barkov2016-01-111-8/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also fixes: MDEV-9391 InnoDB does not produce warnings when doing WHERE int_column=varchar_column MDEV-9337 ALTER from DECIMAL and INT to DATETIME returns a wrong result MDEV-9340 Copying from INT/DOUBLE to ENUM is inconsistent MDEV-9392 Copying from DECIMAL to YEAR is not consistent about warnings
* | | | Merge remote-tracking branch 'origin/10.1' into 10.2Alexander Barkov2015-12-291-5/+16
|\ \ \ \ | |/ / /
| * | | Merge remote-tracking branch 'origin/10.0' into 10.1Alexander Barkov2015-12-291-5/+5
| |\ \ \ | | |/ /
| | * | Merge remote-tracking branch 'origin/5.5' into 10.0Alexander Barkov2015-12-291-5/+5
| | |\ \ | | | |/
| | | * Moving Field_blob::store_length() back from protected to public,Alexander Barkov2015-12-291-5/+5
| | | | | | | | | | | | | | | | as it's needed for Cassandra in 10.0.
| * | | Merge remote-tracking branch 'origin/10.0' into 10.1Alexander Barkov2015-12-291-5/+6
| |\ \ \ | | |/ /
| | * | Merge remote-tracking branch 'origin/5.5' into 10.0Alexander Barkov2015-12-291-5/+6
| | |\ \ | | | |/
| | | * MDEV-9319 ALTER from a bigger to a smaller blob type truncates too much dataAlexander Barkov2015-12-291-5/+6
| | | |
| | | * Merge branch 'mysql/5.5' into 5.5Sergei Golubchik2015-12-091-10/+10
| | | |\
| | | | * Bug #22123583: MYSQL 5.5: MAIN.SP HAS VALGRIND ISSUESSreeharsha Ramanavarapu2015-11-031-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue: ----- When a varchar column is used to fill the record in an internal temporary table, the length of the string stored in the column is not taken into account. Instead the default length of packed data is used to copy with memmove. This will cause valgrind issues since some bytes are uninitialized. SOLUTION: --------- The solution is to take into account the length of the string stored in the column while filling the record. This fix is a backport of BUG#13389854.
| * | | | MDEV-8605 MariaDB not use DEFAULT value even when inserted NULL for NOT ↵Sergei Golubchik2015-12-211-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NULLABLE column NOT NULL constraint must be checked *after* the BEFORE triggers. That is for INSERT and UPDATE statements even NOT NULL fields must be able to store a NULL temporarily at least while BEFORE INSERT/UPDATE triggers are running.
* | | | | Adding "const" qualifier to methods Field::eq_def() andAlexander Barkov2015-12-281-5/+5
| | | | | | | | | | | | | | | | | | | | Copy_field::get_copy_func().
* | | | | MDEV-9327 Split memcpy_field_possible() into virtual methods in FieldAlexander Barkov2015-12-271-0/+45
| | | | |
* | | | | MDEV-9326 Split field_conv_incompatible() into methodsAlexander Barkov2015-12-261-3/+52
| | | | |
* | | | | Changing the parameter of Field::eq_def() from "Field *" to "const Field *"Alexander Barkov2015-12-241-4/+4
| | | | |
* | | | | MDEV-9316 Add Field::store_hex_hybrid()Alexander Barkov2015-12-231-0/+19
| | | | |
* | | | | Moving the "ha_field_option_struct *option_struct" member fromAlexander Barkov2015-12-041-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Column_definition to Create_field, as it's not needed neither for make_field(), nor for SP variables, SP parameters, SP return values.
* | | | | MDEV-9238 Wrap create_virtual_tmp_table() into a class, split into different ↵Alexander Barkov2015-12-041-6/+0
| | | | | | | | | | | | | | | | | | | | steps
* | | | | A patch for MDEV-4912 Add a plugin to field types (column types)Alexander Barkov2015-11-271-8/+27
| | | | | | | | | | | | | | | | | | | | | | | | | Adding Column_definition::make_field() as a convenience wrapper for ::make_field.
* | | | | MDEV-8715 - Obsolete sql_alloc() in favor of THD::alloc() and thd_alloc()Sergey Vojtovich2015-11-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following left in semi-improved state to keep patch size reasonable: - Field operator new: left thd_alloc(current_thd) - Sql_alloc operator new: left thd_alloc(thd_get_current_thd()) - Item_args constructors: left thd_alloc(thd) - Item_func_interval::fix_length_and_dec(): no THD arg, have to call current_thd - Item_func_dyncol_exists::val_int(): same - Item_dyncol_get::val_str(): same - Item_dyncol_get::val_int(): same - Item_dyncol_get::val_real(): same - Item_dyncol_get::val_decimal(): same - Item_singlerow_subselect::fix_length_and_dec(): same
* | | | | MDEV-8095 Split Create_fieldAlexander Barkov2015-11-251-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | | Part2: moving a few other fields from Column_definition to Create_field. sizeof(sp_variable) is now 200 bytes (vs 248 bytes in 10.1)
* | | | | A joint patch for:Alexander Barkov2015-11-251-13/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - MDEV-8093 sql_yacc.yy: add %type create_field for field_spec and column_def and partially: - MDEV-8095 Split Create_field
* | | | | cleanup: remove Field->stored_in_db, Create_field->stored_in_dbSergei Golubchik2015-11-241-17/+8
|/ / / / | | | | | | | | | | | | | | | | and don't set Create_field->sql_type to MYSQL_TYPE_VIRTUAL temporarily only to change it again few lines later.
* | | | table->write_set was changed if binary logging was used, which caused theMonty2015-11-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | changes in query execution plans. Fixed by introducing table->rpl_write_set which holds which columns should be stored in the binary log. Other things: - Removed some not needed references to read_set and write_set to make code really changing read_set and write_set easier to read (in opt_range.cc) - Added error handling of failed unpack_current_row() - Added missing call to mark_columns_needed_for_insert() for DELAYED INSERT - Removed not used functions in_read_set() and in_write_set() - In rpl_record.cc, removed not used variable error
* | | | MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOBmariadb-10.1.8Alexander Barkov2015-10-151-9/+1
| | | |
* | | | Merge branch '10.0' into 10.1Sergei Golubchik2015-10-121-1/+19
|\ \ \ \ | |/ / /
| * | | Merge branch '5.5' into 10.0Sergei Golubchik2015-10-091-1/+16
| |\ \ \ | | |/ /
| | * | Merge remote-tracking branch 'mysql/5.5' into 5.5Sergei Golubchik2015-10-081-2/+17
| | |\ \ | | | |/