Commit graph

45092 commits

Author SHA1 Message Date
Igor Babaev
a2b8bdfbb9 Merge branch '10.2' into bb-10.2-mdev9864 2016-09-07 15:49:56 -07:00
Oleksandr Byelkin
4ec088f2e7 MDEV-8348: Add catchall to all table partitioning for list partitions
DEFAULT partition support added to LIST and LIST COLUMN partitioning.
Partitions Prunning added for DEFAULT partititon.
2016-09-07 17:26:36 +02:00
Sergei Petrunia
95b8dcbd43 MDEV-10729: Server crashes in st_select_lex::set_explain_type
Make the new (CTE-related) code in set_explain_type to take into
account that some JOIN_TABs are non-merged semi-joins, and do not
have a TABLE object.
2016-09-07 17:14:30 +03:00
Sergei Petrunia
e305054f31 MDEV-10058: Suspicious EXPLAIN output for a derived table + WITH + joined tabl
Add a testcase
2016-09-07 12:22:41 +03:00
Sergei Petrunia
4c39f75c73 MDEV-10057: Crash with EXPLAIN + WITH + constant query
Add the testcase
2016-09-07 11:35:06 +03:00
Sergei Petrunia
06ba09d604 Merge branch '10.2' of github.com:MariaDB/server into 10.2 2016-09-07 11:17:41 +03:00
Igor Babaev
5684f9d2d1 Merge branch '10.2' into bb-10.2-mdev9864 2016-09-06 14:43:05 -07:00
Igor Babaev
d6f87e68f1 For some unclear reasons the test case for bug mdev-10736
does not work in non-debug modes.
2016-09-06 14:36:59 -07:00
Igor Babaev
2c6d620019 Merge branch '10.2' into bb-10.2-mdev9864 2016-09-06 10:57:14 -07:00
Igor Babaev
2d36e5aa38 Fixed bug mdev-10736 that caused crashes.
The bug manifested itself for recursive definitions that
used anchors over tables with blobs.
2016-09-06 10:05:36 -07:00
Alexey Botchkov
225440047d MDEV-10421 duplicate CHECK CONSTRAINTs.
mysql_prepare_create_table fixed so it doesn't let duplicating
        constraint names. Syntax for CONSTRAINT IF NOT EXISTS added
        and handled in mysql_alter_table.
2016-09-06 14:42:33 +04:00
Alexander Barkov
ee19806b8e MDEV-9711 NO PAD collations
Based on the patch from Daniil Medvedev (a Google Summer of Code task)
2016-09-06 12:50:02 +04:00
Alexander Barkov
e4f6fd5e12 MDEV-10743 LDML: a new syntax to reuse sort order from another 8bit simple collation 2016-09-06 12:37:11 +04:00
Igor Babaev
8ae65920fa Fixed bug mdev-10737.
This bug in st_select_lex_node::move_node could result
in invalid select lists in recursive units that could
cause falling into infinite loops when iterating over
selects in such units.
2016-09-05 23:07:31 -07:00
Igor Babaev
de02bfd373 The code that pushed conditions into derived did not
take into account that the list of equal items in
an Item_equal object may contain items with type() == REF_ITEM.
2016-09-05 22:10:50 -07:00
Igor Babaev
7faff4de82 Merge branch '10.2' into 10.2-mdev9197 2016-09-04 20:42:07 -07:00
Igor Babaev
3b40f78ede Fixed a flaw in the implementation of condition push-down
for materialized views and derived tables: there were no
push-down if the view was defined as union of selects
without aggregation. Added test cases with such unions.

Adjusted result files after the merge of the code for mdev-9197.
2016-09-04 20:11:58 -07:00
Oleksandr Byelkin
1da21cd4a5 MDEV-10035: DBUG_ASSERT on CREATE VIEW v1 AS SELECT * FROM t1 FOR UPDATE
Ability to print lock type added.
Restoring correct lock type for CREATE VIEW added.
2016-09-04 14:15:21 +02:00
Alexander Barkov
1ca595fbf7 LDML refactoring for "MDEV-9711 NO PAD collations"
- Moving detection of the MY_CS_CSSORT, MY_CS_PUREASCII, MY_CS_NONASCII
  flags of loadable collations from add_collation() in mysys.c
  to my_cset_init_8bit() and my_coll_init_simple() in ctype-simple.c.

- Adding tests that these flags are set properly for loadable collations

- Moving LDML test related *.xml files from mysql-test/std_data/
  to mysql-test/std_data/ldml/, as there will be more *.xml test files
2016-09-03 09:05:56 +04:00
Oleksandr Byelkin
a6fb6473cf MDEV-10419: crash in mariadb 10.1.16-MariaDB-1~trusty
Fixed initialization and usage of THD reference in subselect engines.
2016-09-02 16:20:38 +03:00
Igor Babaev
3fb4f9bb93 Merge branch '10.2-mdev9197-cons' of github.com:shagalla/server
into branch 10.2-mdev9197.
2016-08-31 16:16:54 -07:00
Igor Babaev
2250e9ea26 Merge 10.2 into 10.2-mdev9864. 2016-08-30 16:14:51 -07:00
Igor Babaev
501fc1a9e2 Returned the test case that was removed by mistake. 2016-08-29 22:58:01 -07:00
Igor Babaev
9ac235ab7d mdev-9864: cleanup, re-factoring.
Added comments.
Added reaction for exceeding maximum number of elements in with clause.
Added a test case to check this reaction.
Added a test case where the specification of a recursive table
uses two non-recursive with tables.
2016-08-29 22:45:17 -07:00
Sergei Golubchik
eac7e57529 Feature_check_constraint status variable 2016-08-27 16:59:13 +02:00
Sergei Golubchik
12d2c4fcd0 optimize constant default expressions
to be calculated at the CREATE TABLE time and stored in
the default row image.
2016-08-27 16:59:12 +02:00
Sergei Golubchik
4070d55735 fix: CHECK and DEFAULT after CREATE ... SELECT
expression defaults and check constraints should behave as
constant default values - copied from fields, not copied from expressions
2016-08-27 16:59:12 +02:00
Sergei Golubchik
266563ad77 fix: CREATE TABLE (col TIMESTAMP(6) DEFAULT NOW(2))
That is, when the precision of DEFAULT NOW() is less than
the precision of the column, do not convert it to unireg_check,
use the new approach where DEFAULT is tryly an expression.
2016-08-27 16:59:12 +02:00
Sergei Golubchik
73a220aac3 session-state dependent functions in DEFAULT/CHECK/vcols
* 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)
2016-08-27 16:59:12 +02:00
Galina Shalygina
eb2c147475 The consolidated patch for mdev-9197. 2016-08-23 00:39:12 +03:00
Vladislav Vaintroub
31a8cf54c8 Revert "MDEV-9293 Connector/C integration"
This reverts commit 7b89b9f510.
2016-08-19 15:46:27 +00:00
Vladislav Vaintroub
7b89b9f510 MDEV-9293 Connector/C integration 2016-08-19 15:27:37 +00:00
Igor Babaev
2f9555c40f Removed the parameter from st_select_lex_unit::exec_recursive.
Moved checking whether the limit set for the number of iterations
when executing a recursive query has been reached from
st_select_lex_unit::exec_recursive to TABLE_LIST::fill_recursive.
Changed the name of the system variable max_recursion_level for
max_recursive_iterations.
Adjusted test cases.
2016-08-10 15:51:40 -07:00
Nirbhay Choubey
df9b4554b7 MDEV-10216: Assertion `strcmp(share->unique_file_name,filename) ||
.. share->last_version' failed in myisam/mi_open.c:67: test_if_reopen

During the RENAME operation since the renamed temporary table is also
opened and added to myisam_open_list/maria_open_list, resetting the
last_version at the end of operation (HA_EXTRA_PREPARE_FOR_RENAME)
will cause an assertion failure when a subsequent query tries to open
an additional temporary table instance and thus attempts to reuse it
from the open table list.

This commit fixes the issue by skipping flush/close operations executed
toward the end of ALTER for temporary tables. It also enables a shortcut
for simple ALTERs (like rename, disable/enable keys) on temporary
tables.

As safety checks, added some assertions at code points that should not
be hit for temporary tables.
2016-08-08 17:26:06 -04:00
Sergei Petrunia
a2f245e49f MDEV-10372: EXPLAIN fixes for recursive CTEs, including FORMAT=JSON
- Tabular EXPLAIN now prints "RECURSIVE UNION".
- There is a basic implementation of EXPLAIN FORMAT=JSON.
- it produces "recursive_union" JSON struct
- No other details or ANALYZE support, yet.
2016-08-08 23:02:52 +03:00
Igor Babaev
e1c92a6ca9 Fixed a problem with unreferenced CTE:
explain for the query containing WITH clause
with an unreferenced CTE caused a crash.
Added a test covered this case.

Also added a test for usage CTE in different parts of union.
2016-08-05 14:12:01 -07:00
Daniel Black
e7e313f46f test case for CRC32() SQL function 2016-08-05 10:34:26 +04:00
Oleksandr Byelkin
86975e0492 MDEV-7901: re-implement analyze table for low impact
Table before collecting engine independent statistics now is reopened in read mode,
InnoDB allow write operations in this case.
2016-08-03 21:37:19 +02:00
Igor Babaev
247632e67e Fixed bug mdev-10344.
The patch for bug mdev-9937 actually did not fix the problem
of name resolution for tables used in views referred in queries
with WITH clauses. This fix corrects the patch.
2016-07-29 01:10:00 -07:00
Igor Babaev
f982d1074a Fixed the following problem:
Temporary tables created for recursive CTE
were instantiated at the prepare phase. As
a result these temporary tables missed
indexes for look-ups and optimizer could not
use them.
2016-07-26 22:58:33 -07:00
Sergei Golubchik
b258f91103 fix ALTER TABLE .. DROP CONSTRAINT IF NOT EXISTS 2016-07-02 14:52:23 +02:00
Igor Babaev
8c6a9aa30f Added a proper check for acceptable mutually recursive CTE. 2016-06-30 15:13:12 -07:00
Sergei Golubchik
932646b1ff Merge branch '10.1' into 10.2 2016-06-30 16:38:05 +02:00
Sergei Golubchik
8f9530a9ab revert second lookahead in the lexer
it's not enough to look for NOT NULL IS, this also fails queries like
SELECT NOT NULL <=> NULL;
and adds no value anymore, as the grammar now requires parentheses
2016-06-30 11:43:02 +02:00
Sergei Golubchik
80de816df0 test for ALTER TABLE ... SET DEFAULT 2016-06-30 11:43:02 +02:00
Sergei Golubchik
3687edeec9 clarify the order of evaluation for INSERT 2016-06-30 11:43:02 +02:00
Sergei Golubchik
5f22379fc8 fix for CREATE ... ( ... DEFAULT const_expr ... )
make it return same errors on CREATE as

CREATE ... ( ... DEFAULT const ... )
2016-06-30 11:43:02 +02:00
Sergei Golubchik
0a056c9b53 better ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED 2016-06-30 11:43:02 +02:00
Sergei Golubchik
1b4f0962c1 fix grammar for "DEFAULT (SELECT 1)" not be a syntax error
the error should be "subselect is not allowed here", same as for
DEFAULT ((SELECT 1))
2016-06-30 11:43:02 +02:00
Sergei Golubchik
e8bdb73ade function DEFAULT(x) now works for expression defaults 2016-06-30 11:43:02 +02:00