summaryrefslogtreecommitdiff
path: root/mysql-test/t/union.test
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-8380: Subquery parse errorOleksandr Byelkin2015-10-061-0/+37
| | | | | | backport mysql parser fixes 0034963fbf199696792491bcb79d5f0731c98804 5948561812bc691bd0c13cf518a3fe77d9daf920
* MDEV-3929 Add system variable explicit_defaults_for_timestamp for ↵Alexander Barkov2015-09-221-1/+1
| | | | compatibility with MySQL
* Merge branch '10.0' into bb-10.1-mergeSergei Golubchik2014-12-021-0/+20
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .bzrignore VERSION cmake/plugin.cmake debian/dist/Debian/control debian/dist/Ubuntu/control mysql-test/r/join_outer.result mysql-test/r/join_outer_jcl6.result mysql-test/r/null.result mysql-test/r/old-mode.result mysql-test/r/union.result mysql-test/t/join_outer.test mysql-test/t/null.test mysql-test/t/old-mode.test mysql-test/t/union.test packaging/rpm-oel/mysql.spec.in scripts/mysql_config.sh sql/ha_ndbcluster.cc sql/ha_ndbcluster_binlog.cc sql/ha_ndbcluster_cond.cc sql/item_cmpfunc.h sql/lock.cc sql/sql_select.cc sql/sql_show.cc sql/sql_update.cc sql/sql_yacc.yy storage/innobase/buf/buf0flu.cc storage/innobase/fil/fil0fil.cc storage/innobase/include/srv0srv.h storage/innobase/lock/lock0lock.cc storage/tokudb/CMakeLists.txt storage/xtradb/buf/buf0flu.cc storage/xtradb/fil/fil0fil.cc storage/xtradb/include/srv0srv.h storage/xtradb/lock/lock0lock.cc support-files/mysql.spec.sh
| * MDEV-6868: MariaDB server crash ( select with union and order by with ↵unknown2014-11-151-0/+20
| | | | | | | | | | | | subquery ) Excluding ORDER BY condition should be done after preparation it (even to catch syntax errors).
* | Make test results stable.Sergei Golubchik2014-11-301-0/+1
| | | | | | | | (just like in the test below)
* | Merge branch '10.1' of ../10.1-mdev334 into 10.1Igor Babaev2014-10-171-0/+12
|\ \
| * | Fixed bug mdev-6874.Igor Babaev2014-10-171-0/+12
| | | | | | | | | | | | | | | | | | The method subselect_union_engine::no_rows() must take into account the fact that now unit->fake_select_lex is NULL for for select_union_direct objects.
* | | Merge branch 'bb-10.1-merge' into 10.1mariadb-10.1.1Sergei Golubchik2014-10-161-0/+30
|\ \ \ | |/ / |/| / | |/
| * mysql-5.5.39 mergeSergei Golubchik2014-08-021-0/+30
| |\ | | | | | | | | | | | | | | | | | | ~40% bugfixed(*) applied ~40$ bugfixed reverted (incorrect or we're not buggy) ~20% bugfixed applied, despite us being not buggy (*) only changes in the server code, e.g. not cmakefiles
| | * Bug #17059925: UNIONS COMPUTES ROWS_EXAMINED INCORRECTLYmithun2014-05-081-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ISSUE: ------ For UNION of selects, rows examined by the query will be sum of rows examined by individual select operations and rows examined for union operation. The value of session level global counter that is used to count the rows examined by a select statement should be accumulated and reset before it is used for next select statement. But we have missed to reset the same. Because of this examined row count of a select query is accounted more than once. SOLUTION: --------- In union reset the session level global counter used to accumulate count of examined rows after its value is saved. mysql-test/r/union.result: Expected output of testcase added. mysql-test/t/union.test: Test to verify examined row count of Union operations. sql/sql_union.cc: Reset the value of thd->examined_row_count after accumulating the value.
* | | MDEV-334: Backport of UNION ALL optimization from mysql-5.7.Igor Babaev2014-10-141-13/+100
|/ / | | | | | | | | | | Although the original code of mysql-5.7 was adjusted to the current MariaDB code the main ideas of the optimization were preserved.
* | Add a test case for MySQL's:Sergei Golubchik2014-06-031-2/+10
| | | | | | | | | | | | | | Bug #18167356: EXPLAIN W/ EXISTS(SELECT* UNION SELECT*) WHERE ONE OF SELECT* IS DISTINCT FAILS. the bugfix itself was not merged - MariaDB doesn't have this bug.
* | 5.3 mergeSergei Golubchik2013-12-131-0/+16
|\ \
| * | Fixed bug mdev-5382Igor Babaev2013-12-051-0/+16
| | | | | | | | | | | | | | | | | | | | | When marking used columns the function find_field_in_table_ref() erroneously called the walk method for the real item behind a view/derived table field with the second parameter set to TRUE. This erroneous code was introduced in 2006.
* | | Merge 5.3->5.5Alexander Barkov2013-11-141-0/+19
|\ \ \ | |/ /
| * | Fixed bug mdev-5091.Igor Babaev2013-11-131-0/+19
| | | | | | | | | | | | | | | The function SELECT_LEX::update_used_tables should process all ORDER BY lists in any subselect of a union.
* | | Fixed LP bug #1010729.Igor Babaev2012-06-081-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | The bug prevented acceptance of UNION queries whose non-first select clauses contained join expressions with degenerated single-table nests as valid queries. The bug was introduced into mysql-5.5 code line by the patch for bug 33204.
* | | 5.3 mergeSergei Golubchik2012-01-131-0/+4
|\ \ \ | |/ /
| * | Make test results stable.Sergey Petrunya2011-12-301-0/+1
| | |
| * | Made the optimizer switch flags 'outer_join_with_cache', 'semijoin_with_cache'Igor Babaev2011-12-151-0/+3
| | | | | | | | | | | | set to 'on' by default.
| * | Merge with MySQL 5.1.60Michael Widenius2011-11-231-0/+41
| |\ \
* | \ \ mysql-5.5.18 mergeSergei Golubchik2011-11-031-0/+41
|\ \ \ \ | | |_|/ | |/| |
| * | | merge 5.1-security => 5.5-securityTor Didriksen2011-07-111-0/+41
| |\ \ \ | | | |/ | | |/|
| | * | Bug#11765255 - 58201: VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE ↵Tor Didriksen2011-07-111-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FUNCTIONS We must allocate a larger ref_pointer_array. We failed to account for extra items allocated here: #0 find_order_in_list uint el= all_fields.elements; all_fields.push_front(order_item); /* Add new field to field list. */ ref_pointer_array[el]= order_item; order->item= ref_pointer_array + el; #1 setup_order #2 setup_without_group #3 JOIN::prepare mysql-test/r/order_by.result: New test case. mysql-test/r/union.result: New test case. mysql-test/t/order_by.test: New test case. mysql-test/t/union.test: New test case. sql/sql_lex.cc: find_order_in_list() may need some extra space, so multiply og_num by two. sql/sql_union.cc: For UNION, the 'n_sum_items' are accumulated in the "global_parameters" select_lex. This number must be propagated to setup_ref_array() When preparing a 'fake_select_lex' we need to use global_parameters->order_list rather than fake_select_lex->order_list (see comments inside st_select_lex_unit::cleanup)
* | | | merge with 5.3Sergei Golubchik2011-10-191-0/+8
|\ \ \ \ | |/ / / |/| | / | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Bug fix for lp:732124 union + limit returns wrong resultMichael Widenius2011-03-091-0/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysql-test/r/union.result: Added test for lp:732124 mysql-test/t/union.test: Added test for lp:732124 sql/sp_rcontext.cc: Updated function definition for ::send_data() sql/sp_rcontext.h: Updated function definition for ::send_data() sql/sql_analyse.cc: Test if send_data() returned an error sql/sql_class.cc: Updated function definition for ::send_data() sql/sql_class.h: Changed select_result::send_data(List<Item> &items) to return -1 in case of duplicate row that should not be counted as part of LIMIT sql/sql_cursor.cc: Check if send_data returned error sql/sql_delete.cc: Updated function definition for ::send_data() sql/sql_insert.cc: Updated function definition for ::send_data() sql/sql_select.cc: Don't count rows which send_data() tells you to ignore sql/sql_union.cc: Inform caller that the row should be ignored. This is the real bug fix for lp:732124 sql/sql_update.cc: Updated function definition for ::send_data()
* | Bug#58970 Problem Subquery (without referencing a table) Magne Mahre2011-01-101-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and Order By When having a UNION statement in a subquery, with no referenced tables (or only a reference to the virtual table 'dual'), the UNION did not allow an ORDER BY clause. i.e: SELECT(SELECT 1 AS a UNION SELECT 0 AS a ORDER BY a) AS b or SELECT(SELECT 1 AS a FROM dual UNION SELECT 0 as a ORDER BY a) AS b In addition, an ORDER BY / LIMIT clause was not accepted in subqueries even for single SELECT statements with no referenced tables (or with 'dual' as table reference) i.e: SELECT(SELECT 1 AS a ORDER BY a) AS b or SELECT(SELECT 1 AS a FROM dual ORDER BY a) AS b The fix was to allow an optional ORDER BY/LIMIT clause to the grammar for these cases. See also: Bug#57986
* | Bug#57986 ORDER BY clause is not used after a UNION, Magne Mahre2011-01-101-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | if embedded in a SELECT An ORDER BY clause was bound to the incorrect (sub-)statement when used in a UNION context. In a query like: SELECT * FROM a UNION SELECT * FROM b ORDER BY c the result of SELECT * FROM b is sorted, and then combined with a. The correct behaviour is that the ORDER BY clause should be applied on the final set. Similar behaviour was seen on LIMIT clauses as well. In a UNION statement, there will be a select_lex object for each of the two selects, and a select_lex_unit object that describes the UNION itself. Similarly, the same behaviour was also seen on derived tables. The bug was caused by using a grammar rule for ORDER BY and LIMIT that bound these elements to thd->lex->current_select, which points to the last of the two selects, instead of to the fake_select_lex member of the master select_lex_unit object. sql/sql_yacc.yy: Need to use (opt_)union_order_or_limit to bind to the correct select_lex object.
* | some test fixes after merging 57840Bjorn Munch2010-11-061-1/+1
| |
* | WL#5370 Keep forward-compatibility when changing unknown2010-08-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'CREATE TABLE IF NOT EXISTS ... SELECT' behaviour BUG#47132, BUG#47442, BUG49494, BUG#23992 and BUG#48814 will disappear automatically after the this patch. BUG#55617 is fixed by this patch too. This is the 5.5 part. It implements: - 'CREATE TABLE IF NOT EXISTS ... SELECT' statement will not insert anything and binlog anything if the table already exists. It only generate a warning that table already exists. - A couple of test cases for the behavior changing.
* | Manual merge from mysql-trunk-merge.Alexander Nozdrin2010-01-191-0/+55
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: - configure.in - include/m_string.h - mysql-test/extra/rpl_tests/rpl_row_func003.test - mysql-test/r/mysqlbinlog.result - mysql-test/r/union.result - mysql-test/suite/binlog/r/binlog_killed_simulate.result - mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result - mysql-test/suite/binlog/r/binlog_unsafe.result - mysql-test/suite/binlog/t/binlog_unsafe.test - mysql-test/suite/rpl/r/rpl_loaddata_fatal.result - mysql-test/suite/rpl/r/rpl_loaddata_map.result - mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result - mysql-test/suite/rpl/r/rpl_stm_log.result - mysql-test/suite/rpl/t/rpl_optimize.test - mysql-test/t/mysqlbinlog.test - mysql-test/t/union.test - sql/rpl_utility.h - sql/sql_union.cc - strings/Makefile.am
| * Addendum to Bug #49734 : fixed an unstable test case.Georgi Kodinov2010-01-061-0/+2
| |
| * Bug #49734: Crash on EXPLAIN EXTENDED UNION ... ORDER BY <any ↵Georgi Kodinov2009-12-221-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | non-const-function> Several problems fixed : 1. Non constant expressions in UNION ... ORDER BY were not correctly cleaned up in st_select_lex_unit::cleanup() causing crashes in EXPLAIN EXTENDED because of fields quoted by these expressions pointing to the already freed temporary table used to calculate the UNION. Fixed by correctly cleaning up expressions of any depth. 2. Subqueries in the order by part of UNION ... ORDER BY ... caused a crash in EXPLAIN EXTENDED because of a transformation attempt made during EXPLAIN EXTENDED execution. Fixed by not doing the transformation when in EXPLAIN. 3. Fulltext functions caused crash when in the ORDER BY part of an un-parenthesized UNION that gets "promoted" to be valid for the whole union, e.g. SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY MATCHES (a) AGAINST ('abc' IN BOOLEAN MODE). This is a case that demonstrates a more general problem of parts of the query being moved to another level. When doing such transformation late in the optimization run when most of the flags about the contents of the query are already aggregated it's possible to "split" the flags so that they correctly reflect the new queries after the transformation. In specific the ST_SELECT_LEX::ftfunc_list is holding all the free text function for all the parts of the second SELECT in the UNION and we don't know what part of that is in the ORDER BY that we're to move to the UNION level and what part is about the other parts of the second SELECT. Fixed by throwing and error when such statements are about to be processed by adding a check for the presence of MATCH() inside the ORDER BY clause that's going to get promoted to UNION. To workaround this new limitation one must parenthesize the UNION SELECTs and provide a real global ORDER BY for the UNION outside of the parenthesis.
* | Backport of Bug#33204 from mysql-pe toMartin Hansson2009-11-101-82/+42
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysql-next-mr-bugfixing. Bug no 32858 was fixed in two different ways in what was then called mysql 5.1 and 6.0. The fix in 6.0 was very different since bugfix no 33204 was present. Furthermore, the two fixes were not compatible. Hence in order to backport Bug#33204 to the 5.1-based mysql-next-mr-bugfixing, it was necessary to remove the 5.1 fix of 32858 and apply the 6.0 version of the fix. mysql-test/r/subselect.result: Bug#33204-backport: Test result mysql-test/r/union.result: Bug#33204-backport: - Reversal of test result: bugfix no 32858 for 5.1 - Application of test result: bugfix no 32858 for 6.0 mysql-test/t/subselect.test: Bug#33204-backport: - Changed tests - Test case mysql-test/t/union.test: Bug#33204-backport: - Reversal of test: bugfix no 32858 for 5.1 - Application of test: bugfix no 32858 for 6.0 sql/sql_class.cc: Bug#33204-backport: Reversal of bugfix no 32858 for 5.1 sql/sql_class.h: Bug#33204-backport: Reversal of bugfix no 32858 for 5.1 sql/sql_yacc.yy: Bug#33204-backport: - Reversal of bugfix no 32858 for 5.1 - Application of bugfix no 32858 for 6.0 - Application of bugfix no 33204
* 5.0-bugteam->5.1-bugteam mergeSergey Glukhov2009-05-151-0/+12
|\
| * Bug#43612 crash with explain extended, union, order bySergey Glukhov2009-05-151-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In UNION if we use last SELECT without braces and this SELECT have ORDER BY clause, such clause belongs to global UNION. It is parsed like last SELECT part and used further as 'unit->global_parameters->order_list' value. During DESCRIBE EXTENDED we call select_lex->print_order() for last SELECT where order fields refer to tmp table which already freed. It leads to crash. The fix is clean up global_parameters->order_list instead of fake_select_lex->order_list. mysql-test/r/union.result: test result mysql-test/t/union.test: test case sql/sql_union.cc: In UNION if we use last SELECT without braces and this SELECT have ORDER BY clause, such clause belongs to global UNION. It is parsed like last SELECT part and used further as 'unit->global_parameters->order_list' value. During DESCRIBE EXTENDED we call select_lex->print_order() for last SELECT where order fields refer to tmp table which already freed. It leads to crash. The fix is clean up global_parameters->order_list instead of fake_select_lex->order_list.
| * Automerge.Alexey Kopytov2009-03-271-0/+15
| |\
* | \ Automerge.Alexey Kopytov2009-03-271-0/+15
|\ \ \
| * \ \ Manual merge.Alexey Kopytov2009-03-271-0/+15
| |\ \ \ | | | |/ | | |/|
| | * | Fix for bug #43432: Union on floats does unnecessary rounding Alexey Kopytov2009-03-271-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UNION could convert fixed-point FLOAT(M,D)/DOUBLE(M,D) columns to FLOAT/DOUBLE when aggregating data types from the SELECT substatements. While there is nothing particularly wrong with this behavior, especially when M is greater than the hardware precision limits, it could be confusing in cases when all SELECT statements in a union have the same FLOAT(M,D)/DOUBLE(M,D) columns with equal precision specifications listed in the same position. Since the manual is quite vague on what data type should be returned in such cases, the bug was fixed by implementing the most 'expected' behavior: do not convert FLOAT(M,D)/DOUBLE(M,D) to anything else if all SELECT statements in a UNION have the same precision for that column. mysql-test/r/union.result: Added a test case for bug #43432. mysql-test/t/union.test: Added a test case for bug #43432. sql/field.cc: Replaced FLT_DIG+6 and DBL_DIG+7 with a symbolic constant. sql/item.cc: Do not convert FLOAT(M,D)/DOUBLE(M,D) to anything else if all SELECT statements in a UNION have the same precision for that column. sql/mysql_priv.h: Added a symbolic constant for FLT_DIG+6 and DBL_DIG+7.
* | | | Bug#43329 Prepared for push on 5.1Bernt M. Johnsen2009-03-191-10/+33
|\ \ \ \ | |/ / / |/| | / | | |/ | |/|
| * | Bug#43329 prepared for commit on 5.0Bernt M. Johnsen2009-03-181-10/+33
| |/
| * Merge mhansson@bk-internal:/home/bk/mysql-5.0-optunknown2007-12-191-0/+22
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into linux-st28.site:/home/martin/mysql/src/bug32848/my50-bug32848 sql/field.cc: Auto merged sql/field.h: Auto merged sql/item.cc: Auto merged sql/sql_select.cc: Auto merged mysql-test/r/union.result: Bug#32848: Manual merge mysql-test/t/union.test: Bug#32848: Manual merge
* | | A fix for Bug#22891 "session level max_allowed_packet can beStaale Smedseng2008-11-201-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | set but is ignored". This patch makes @@session.max_allowed_packed and @@session.net_buffer_length read-only as suggested in the bug report. The user will have to use SET GLOBAL (and reconnect) to alter the session values of these variables. The error string ER_VARIABLE_IS_READONLY is introduced. Tests are modified accordingly. sql/set_var.cc: The class sys_var_thd_ulong_session_readonly is introduced as a specialization of sys_var_thd_ulong implementing a read-only session variable. The class overrides check() and check_default() to achieve the read-only property for the session part of the variable. sql/set_var.h: The class sys_var_thd_ulong_session_readonly is introduced as a specialization of sys_var_thd_ulong implementing a read-only session variable. The class overrides check() and check_default() to achieve the read-only property for the session part of the variable. sql/share/errmsg.txt: New error ER_VARIABLE_IS_READONLY.
* | | Bug #32858: Erro: "Incorrect usage of UNION and INTO" does not take unknown2008-05-131-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subselects into account It is forbidden to use the SELECT INTO construction inside UNION statements unless on the last SELECT of the union. The parser records whether it has seen INTO or not when parsing a UNION statement. But if the INTO was legally used in an outer query, an error is thrown if UNION is seen in a subquery. Fixed in 5.0 by remembering the nesting level of INTO tokens and mitigate the error unless it collides with the UNION. mysql-test/r/union.result: Bug#32858: Test result mysql-test/t/union.test: Bug#32858: Test case sql/sql_class.cc: Bug#32858: Initializing new member sql/sql_class.h: Bug#32858: Added property nest_level to select_result class. sql/sql_yacc.yy: Bug#32858: The fix.
* | | Merge mhansson@bk-internal:/home/bk/mysql-5.1-optunknown2007-12-211-0/+22
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into linux-st28.site:/home/martin/mysql/src/bug32848/my51-bug32848 sql/field.cc: Auto merged sql/field.h: Auto merged sql/item.cc: Auto merged sql/sql_select.cc: Auto merged mysql-test/r/union.result: Bug#32848: Manual merge mysql-test/t/union.test: Bug#32848: Manual merge
| * \ \ Merge linux-st28.site:/home/martin/mysql/src/bug32848/my50-bug32848-gcaunknown2007-12-201-0/+24
| |\ \ \ | | | |/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into linux-st28.site:/home/martin/mysql/src/bug32848/my51-bug32848-gca mysql-test/r/union.result: Auto merged mysql-test/t/union.test: Auto merged sql/field.h: Auto merged sql/sql_select.cc: Auto merged sql/field.cc: Bug#32848: Manual merge sql/item.cc: Bug#32848: Manual merge
| | * | Bug#32848: Data type conversion bug in union subselects in MySQL 5.0.38unknown2007-12-111-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two problems when inferring the correct field types resulting from UNION queries. - If the type is NULL for all corresponding fields in the UNION, the resulting type would be NULL, while the type is BINARY(0) if there is just a single SELECT NULL. - If one SELECT in the UNION uses a subselect, a temporary table is created to represent the subselect, and the result type defaults to a STRING type, hiding the fact that the type was unknown(just a NULL value). Fixed by remembering whenever a field was created from a NULL value and pass type NULL to the type coercion if that is the case, and creating a string field as result of UNION only if the type would otherwise be NULL. mysql-test/r/union.result: Bug#32848: Test result mysql-test/t/union.test: Bug#32848: Test case sql/field.cc: Bug#32848: Initialization of new field sql/field.h: Bug#32848: New member to record when a field was created from a NULL value. sql/item.cc: Bug#32848: A field created from a NULL value will submit NULL as type to the type coercion procedure. If Item_type_holder has not inferred the correct type after processing all SELECTs in a UNION, a string field is created. sql/sql_select.cc: Bug#32848: Recording when a field is created from a NULL value.
* | | | Merge magare.gmz:/home/kgeorge/mysql/autopush/B19390-5.0-optunknown2007-12-181-0/+44
|\ \ \ \ | |/ / / |/| | / | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into magare.gmz:/home/kgeorge/mysql/work/B19390-5.1-opt client/mysql.cc: Auto merged client/mysqltest.c: Auto merged mysql-test/r/func_gconcat.result: Auto merged mysql-test/suite/rpl/r/rpl_trigger.result: Auto merged mysql-test/suite/rpl/t/rpl_trigger.test: Auto merged mysql-test/t/func_gconcat.test: Auto merged sql/item_sum.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/log.cc: Auto merged sql/set_var.cc: Auto merged sql/sp.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/unireg.cc: Auto merged mysql-test/r/union.result: Merged bug 27848 to 5.1-opt mysql-test/t/union.test: Merged bug 27848 to 5.1-opt sql/sql_yacc.yy: Merged bug 27848 to 5.1-opt
| * | Merge mhansson@bk-internal:/home/bk/mysql-5.0-optunknown2007-12-151-0/+57
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into linux-st28.site:/home/martin/mysql/src/bug32858/my50-bug32858-push sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_yacc.yy: Auto merged mysql-test/r/union.result: Bug#32858: Manual merge mysql-test/t/union.test: Bug#32858: Manual merge