summaryrefslogtreecommitdiff
path: root/mysql-test/suite/vcol
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-29446 Change SHOW CREATE TABLE to display default collationAlexander Barkov2022-09-1219-282/+282
|
* bugfix: RAND is VCOL_SESSION_FUNCSergei Golubchik2022-07-292-0/+29
| | | | | | it's not "non deterministic", it's completely defined by @@rand_seed1 and @@rand_seed2. And as a session func it needs to be re-fixed at the beginning of every statement.
* MDEV-21445 Strange/inconsistent behavior of IN condition when mixing numbers ↵Alexander Barkov2022-07-061-6/+6
| | | | and strings
* Merge branch '10.2' into 10.3Sergei Golubchik2022-04-216-7/+82
|\
| * vcols: cannot use CONTEXT_ANALYSIS_ONLY_VCOL_EXPR on fix_fieldsSergei Golubchik2022-04-193-1/+37
| | | | | | | | | | | | | | because CONTEXT_ANALYSIS_ONLY_VCOL_EXPR can be used only for, exactly, context analysys. Items fixed that way cannot be evaluated. But vcols are going to be evaluated, so they have to be fixed properly, for evaluation.
| * MDEV-28092 MariaDB SEGV issueSergei Golubchik2022-04-192-0/+19
| | | | | | | | add test
| * MDEV-26281 ASAN use-after-poison when complex conversion is involved in blobSergei Golubchik2022-04-142-6/+36
| | | | | | | | | | | | | | | | | | | | | | | | the bug was that in_vector array in Item_func_in was allocated in the statement arena, not in the table->expr_arena. revert part of the 5acd391e8b2d. Instead, change the arena correctly in fix_all_session_vcol_exprs(). Remove TABLE_ARENA, that was introduced in 5acd391e8b2d to force item tree changes to be rolled back (because they were allocated in the wrong arena and didn't persist. now they do)
* | MDEV-24176 Server crashes after insert in the table with virtualAleksey Midenkov2022-04-182-2/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | column generated using date_format() and if() vcol_info->expr is allocated on expr_arena at parsing stage. Since expr item is allocated on expr_arena all its containee items must be allocated on expr_arena too. Otherwise fix_session_expr() will encounter prematurely freed item. When table is reopened from cache vcol_info contains stale expression. We refresh expression via TABLE::vcol_fix_exprs() but first we must prepare a proper context (Vcol_expr_context) which meets some requirements: 1. As noted above expr update must be done on expr_arena as there may be new items created. It was a bug in fix_session_expr_for_read() and was just not reproduced because of no second refix. Now refix is done for more cases so it does reproduce. Tests affected: vcol.binlog 2. Also name resolution context must be narrowed to the single table. Tested by: vcol.update main.default vcol.vcol_syntax gcol.gcol_bugfixes 3. sql_mode must be clean and not fail expr update. sql_mode such as MODE_NO_BACKSLASH_ESCAPES, MODE_NO_ZERO_IN_DATE, etc must not affect vcol expression update. If the table was created successfully any further evaluation must not fail. Tests affected: main.func_like Reviewed by: Sergei Golubchik <serg@mariadb.org>
* | Merge branch '10.2' into 10.3mariadb-10.3.33Oleksandr Byelkin2022-01-292-0/+18
|\ \ | |/
| * test cases for MySQL bugsSergei Golubchik2022-01-212-0/+18
| | | | | | | | also fix a comment, and update a macro just in case
* | Merge 10.2 into 10.3Marko Mäkelä2021-08-182-0/+121
|\ \ | |/ | | | | MDEV-18734 FIXME: vcol.partition triggers ASAN heap-use-after-free
| * MDEV-18734 ASAN heap-use-after-free upon sorting by blob column from ↵Aleksey Midenkov2021-08-052-0/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | partitioned table ha_partition stores records in array of m_ordered_rec_buffer and uses it for prio queue in ordered index scan. When the records are restored from the array the blob buffers may be already freed or rewritten. The solution is to take temporary ownership of cached blob buffers via String::swap(). When the record is restored from m_ordered_rec_buffer the ownership is returned to table fields. Cleanups: init_record_priority_queue(): removed needless !m_ordered_rec_buffer check as there is same assertion few lines before. dbug_print_row() for arbitrary row pointer
* | Merge branch '10.2' into 10.3Sergei Golubchik2021-07-212-0/+28
|\ \ | |/
| * [1/2] MDEV-18166 ASSERT_COLUMN_MARKED_FOR_READ failed on tables with vcolsNikita Malyavin2021-07-122-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a 10.2+ part of a jira task The two bugs regarding virtual column marking have been fixed: 1. UPDATE of a partitioned table, where the optimizer has chosen a secondary index to make a filesort; 2. INSERT into a table with a nonblob field generated from a blob, with binlog enabled and binlog_row_image=noblob. 3. DELETE from a view on a table with virtual column. Generally the assertion happens from update_virtual_fields() call These bugs are root-caused by missing field marking for dependant fields of a virtual column. Therefore a fix is: mark all the fields involved in the vcol expression by calling field->register_field_in_read_map() instead just setting a single bit. 3 was reproducible only on 10.4+, however the problem might has just been invisible in the earlier versions. The fix is applicable to 10.2-10.3 as well.
* | Merge 10.2 into 10.3Marko Mäkelä2021-06-082-5/+23
|\ \ | |/
| * MDEV-25672 table alias from previous statement interferes later commandsSergei Golubchik2021-06-022-5/+23
| | | | | | | | | | only perform the "correct table name" check for *new* generated columns, but not for already existing ones - they're guaranteed to be valid
* | Merge branch bb-10.2-release into bb-10.3-releaseNikita Malyavin2021-05-042-0/+27
|\ \ | |/
| * MDEV-24583 SELECT aborts after failed REPLACE into table with vcolNikita Malyavin2021-04-272-0/+27
| | | | | | | | | | | | | | table->move_fields wasn't undone in case of error. 1. move_fields is unconditionally undone even when error is occurred 2. cherry-pick an assertion in `ptr_in_record`, which is already in 10.5
* | Merge 10.2 into 10.3Marko Mäkelä2021-04-242-0/+82
|\ \ | |/ | | | | except commit 1288dfffe77a99d6c5906d12010a1677ee149308
| * MDEV-25091 CREATE TABLE: field references qualified by a wrong table name ↵Aleksey Midenkov2021-04-232-0/+82
| | | | | | | | | | | | | | | | | | | | | | succeed Before FRM is written walk vcol expressions through check_table_name_processor() and check if field items match (db, table_name) qualifier. We cannot do this in check_vcol_func_processor() as there is already no table name qualifiers in expressions of written and loaded FRM.
* | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-10-301-1/+1
|\ \ | |/
| * Merge branch '10.1' into 10.2Oleksandr Byelkin2020-10-291-1/+1
| |\
| | * MDEV-23702 calculating(auto rounding) issueSergei Golubchik2020-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement a different fix for "MDEV-19232: Floating point precision / value comparison problem" Instead of truncating decimal values after every division, truncate them for comparison purposes. This reverts commit 62d73df6b270 but keeps the test.
* | | Merge 10.2 into 10.3Marko Mäkelä2020-09-032-4/+4
|\ \ \ | |/ /
| * | MDEV-20618 Assertion failed in row_upd_sec_index_entryNikita Malyavin2020-09-012-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a proper error handling of innobase_get_computed_value results in row_upd_store_row/row_upd_store_v_row. Also add an assertion in row_vers_build_clust_v_col to fail during row purge. Add one more assertion in row_sel_sec_rec_is_for_clust_rec for possible future catches.
* | | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-08-031-1/+1
|\ \ \ | |/ /
| * | Merge branch '10.1' into 10.2Oleksandr Byelkin2020-08-021-1/+1
| |\ \ | | |/
| | * MDEV-19232: Floating point precision / value comparison problemVarun Gupta2020-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The issue occurs when the subquery_cache is enabled. When there is a cache miss the division was leading to a value with scale 9. In the case of cache hit the value returned was of scale 9 and due to the different values for the scales the where condition evaluated to FALSE, hence the output was incomplete. To fix this problem we need to round up the decimal to the limit mentioned in Item::decimals. This would make sure the values are compared with the same scale.
* | | Merge 10.2 into 10.3Marko Mäkelä2020-05-272-0/+20
|\ \ \ | |/ /
| * | MDEV-20015 Assertion `!in_use->is_error()' failed in TABLE::update_virtual_fieldAleksey Midenkov2020-05-262-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | update_virtual_field() is called as part of index rebuild in ha_myisam::repair() (MDEV-5800) which is done on bulk INSERT finish. Assertion in update_virtual_field() was put as part of MDEV-16222 because update_virtual_field() returns in_use->is_error(). The idea: wrongly mixed semantics of error status before update_virtual_field() and the status returned by update_virtual_field(). The former can falsely influence the latter.
* | | Merge remote-tracking branch 'origin/10.2' into 10.3Alexander Barkov2020-05-162-0/+113
|\ \ \ | |/ /
| * | Merge remote-tracking branch 'origin/10.1' into 10.2Alexander Barkov2020-05-162-0/+113
| |\ \ | | |/ | | | | | | Also, adding 10.2 related changes for MDEV-22579
| | * MDEV-22579 No error when inserting DEFAULT(non_virtual_column) into a ↵Alexander Barkov2020-05-152-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | virtual column The code erroneously allowed both: INSERT INTO t1 (vcol) VALUES (DEFAULT); INSERT INTO t1 (vcol) VALUES (DEFAULT(non_virtual_column)); The former is OK, but the latter is not. Adding a new virtual method in Item: virtual bool vcol_assignment_allowed_value() const { return false; } Item_null, Item_param and Item_default_value override it. Item_default_value overrides it in the way to: - allow DEFAULT - disallow DEFAULT(col)
* | | Merge branch '10.2' into 10.3Oleksandr Byelkin2019-10-313-0/+34
|\ \ \ | |/ /
| * | MDEV-20799 DROP Virtual Column crashes MariaDBSergei Golubchik2019-10-283-0/+34
| | | | | | | | | | | | | | | use the correct table for evaluating virtual columns in the InnoDB ALTER TABLE.
* | | Merge branch '10.2' into 10.3Sergei Golubchik2019-09-064-112/+287
|\ \ \ | |/ /
| * | Part3: MDEV-18156 Assertion `0' failed or `btr_validate_index(index, 0, ↵Sergei Golubchik2019-09-064-112/+291
| | | | | | | | | | | | | | | | | | | | | false)' in row_upd_sec_index_entry or error code 126: Index is corrupted upon DELETE with PAD_CHAR_TO_FULL_LENGTH Don't break compatibility in GA releases. Warn the user, but don't refuse to create a table until 10.5
* | | Merge 10.2 (up to commit ef00ac4c86daf3294c46a45358da636763fb0049) into 10.3Alexander Barkov2019-09-0410-10/+1299
|\ \ \ | |/ /
| * | Part2: MDEV-18156 Assertion `0' failed or `btr_validate_index(index, 0, ↵Alexander Barkov2019-09-034-0/+538
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | false)' in row_upd_sec_index_entry or error code 126: Index is corrupted upon DELETE with PAD_CHAR_TO_FULL_LENGTH This patch allows the server to open old tables that have "bad" generated columns (i.e. indexed virtual generated columns, persistent generated columns) that depend on sql_mode, for general things like SELECT, INSERT, DROP, etc. Warning are issued in such cases. Only these commands are now disallowed and return an error: - CREATE TABLE introducing a "bad" generated column - ALTER TABLE introducing a "bad" generated column - CREATE INDEX introdicing a "bad" generated column (i.e. adding an index on a virtual generated column that depends on sql_mode). Note, these commands are allowed: - ALTER TABLE removing a "bad" generate column - ALTER TABLE removing an index from a "bad" virtual generated column - DROP INDEX removing an index from a "bad" virtual generated column but only if the table does not have any "bad" columns as a result.
| * | MDEV-18156 Assertion `0' failed or `btr_validate_index(index, 0, false)' in ↵Alexander Barkov2019-09-038-10/+757
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | row_upd_sec_index_entry or error code 126: Index is corrupted upon DELETE with PAD_CHAR_TO_FULL_LENGTH This change takes into account a column's GENERATED ALWAYS AS expression dependcy on sql_mode's PAD_CHAR_TO_FULL_LENGTH and NO_UNSIGNED_SUBTRACTION flags. Indexed virtual columns as well as persistent generated columns are now not allowed to have such dependencies to avoid inconsistent data or index files on sql_mode changes. So an error is now returned in cases like this: CREATE OR REPLACE TABLE t1 ( a CHAR(5), v VARCHAR(5) AS (a) PERSISTENT -- CHAR->VARCHAR or CHAR->TEXT = ERROR ); Functions RPAD() and RTRIM() can now remove dependency on PAD_CHAR_TO_FULL_LENGTH. So this can be used instead: CREATE OR REPLACE TABLE t1 ( a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) PERSISTENT ); Note, unlike CHAR->VARCHAR and CHAR->TEXT this still works, not RPAD(a) is needed: CREATE OR REPLACE TABLE t1 ( a CHAR(5), v CHAR(5) AS (a) PERSISTENT -- CHAR->CHAR is OK ); More sql_mode flags may affect values of generated columns. They will be addressed separately. See comments in sql_mode.h for implementation details.
* | | Merge branch '10.2' into 10.3Monty2019-09-033-21/+26
|\ \ \ | |/ /
| * | Updated mtr files to support different compiled in optionsMonty2019-09-013-21/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows one to run the test suite even if any of the following options are changed: - character-set-server - collation-server - join-cache-level - log-basename - max-allowed-packet - optimizer-switch - query-cache-size and query-cache-type - skip-name-resolve - table-definition-cache - table-open-cache - Some innodb options etc Changes: - Don't print out the value of system variables as one can't depend on them to being constants. - Don't set global variables to 'default' as the default may not be the same as the test was started with if there was an additional option file. Instead save original value and reset it at end of test. - Test that depends on the latin1 character set should include default_charset.inc or set the character set to latin1 - Test that depends on the original optimizer switch, should include default_optimizer_switch.inc - Test that depends on the value of a specific system variable should set it in the test (like optimizer_use_condition_selectivity) - Split subselect3.test into subselect3.test and subselect3.inc to make it easier to set and reset system variables. - Added .opt files for test that required specfic options that could be changed by external configuration files. - Fixed result files in rockdsb & tokudb that had not been updated for a while.
* | | Merge 10.2 into 10.3Marko Mäkelä2019-06-192-6/+78
|\ \ \ | |/ /
| * | Trivial test result update after fix for MDEV-19771Sergei Petrunia2019-06-161-4/+4
| | |
| * | MDEV-19771 REPLACE on table with virtual_field can cause crashMichael Widenius2019-06-152-4/+76
| | | | | | | | | | | | | | | | | | | | | Fixes also MDEV-17837 Problem was that we did not ignore warnings from virtual fields when updated virtual fields for to-be-replaced row.
* | | Merge 10.2 into 10.3Marko Mäkelä2019-04-274-0/+92
|\ \ \ | |/ /
| * | Tests for MDEV-15881 Assertion `is_valid_value_slow()' failed in ↵Alexander Barkov2019-04-262-0/+53
| | | | | | | | | | | | | | | | | | | | | Datetime::Datetime or corrupt data after ALTER with indexed persistent column The patch for "MDEV-18486 Database crash on a table with indexed virtual column" fixed MDEV-15881 as well. So adding tests only.
| * | MDEV-16518 MYSQL57_GENERATED_FIELD: The code in ↵Alexander Barkov2019-04-262-0/+39
| | | | | | | | | | | | TABLE_SHARE::init_from_binary_frm_image() is not safe
* | | Merge 10.2 into 10.3Marko Mäkelä2019-03-278-54/+54
|\ \ \ | |/ /
| * | Merge 10.1 into 10.2Marko Mäkelä2019-03-278-54/+54
| |\ \ | | |/