Commit graph

66363 commits

Author SHA1 Message Date
Sergei Golubchik
bc4409ab4e MDEV-13868 cannot insert 1288481126 in a timestamp column in Europe/Moscow
make insert NULL into a timestamp mark the field as having an
explicit value. So that the field won't be assigned the value
again in TABLE::update_default_field()

make Item_func_now_local::save_in_field(timestamp_field) not to go
through MYSQL_TIME - this conversion is lossy around DST change times.
This fixes inserting a default value into a timestamp field.
2017-09-22 13:58:00 +02:00
Sergei Golubchik
f1ce69f3a9 Merge branch '10.1' into 10.2
But without f4f48e06215..f8a800bec81 - fixes for MDEV-12672
and related issues. 10.2 specific fix follows...
2017-09-22 02:27:00 +02:00
Sergei Golubchik
f8a800bec8 bugfix: copy timestamps correctly in INSERT...SELECT
don't do it via MYSQL_TIME, that conversion is lossy
around DST change dates.
2017-09-21 22:03:28 +02:00
Sergei Golubchik
f4f48e0621 MDEV-12672 Replicated TIMESTAMP fields given wrong value near DST change
Implement a special Copy_field method for timestamps, that copies
timestamps without converting them to MYSQL_TIME (the conversion
is lossy around DST change dates).
2017-09-21 22:03:21 +02:00
Sergei Golubchik
2e3a16e366 Merge branch '10.0' into 10.1 2017-09-21 22:02:21 +02:00
Sergei Golubchik
8d0448d507 MDEV-13861 Assertion `0' failed in Protocol::end_statement
followup for 378beed0a6 - only count WARN_LEVEL_ERROR,
not warnings or notes.
2017-09-21 21:43:07 +02:00
Sergei Golubchik
1015196e0a cleanup: TABLE_LIST::view_check_option
don't prepare for checking view's CHECK OPTION, if
there is no CHECK OPTION in the first place.
2017-09-21 10:04:29 +02:00
Sachin Setiya
e84f5356c3 MDEV-12290 Wrong timestamps in binary log causes replication issues
Binlog_background_thread does not make a call to set_time(), And when
we call binlog_checkpoint_log_event->write() , we write the wrong timestamp.
In this patch we correct this by calling thd->set_time().
2017-09-21 13:22:49 +05:30
Marko Mäkelä
dc112d2f48 Fix -Wimplicit-fallthrough warnings (no functional change) 2017-09-20 22:46:25 +03:00
Sergei Golubchik
378beed0a6 MDEV-13290: Assertion Assertion !is_set() || (m_status == DA_OK_BULK && is_bulk_op())' or ! is_set()' failed
followup for 97c2a7354b - don't use thd->is_error(),
the error could've been set before TABLE_LIST::cleanup_items.
Use the error handler to count errors.

This fixes rpl.rpl_row_binlog_max_cache_size - it was failing when
ER_STMT_CACHE_FULL happened duing multi-table update. Because
multi_update::abort_result_set() calls do_updates() to update
as much as possible, so one cannot rely on thd->is_error() after that.
2017-09-20 20:02:17 +02:00
Marko Mäkelä
96f06f952d MDEV-13847 Allow ALTER TABLE…ADD SPATIAL INDEX…ALGORITHM=INPLACE
MDEV-13851 Always check table options in ALTER TABLE…ALGORITHM=INPLACE

In the merge of MySQL 5.7.9 to MariaDB 10.2.2, some code was included
that prevents ADD SPATIAL INDEX from being executed with ALGORITHM=INPLACE.

Also, the constant ADD_SPATIAL_INDEX was introduced as an alias
to ADD_INDEX. We will remove that alias now, and properly implement
the same ADD SPATIAL INDEX restrictions as MySQL 5.7 does:

1. table-rebuilding operations are not allowed if SPATIAL INDEX survive it
2. ALTER TABLE…ADD SPATIAL INDEX…LOCK=NONE is not allowed

ha_innobase::prepare_inplace_alter_table(): If the ALTER TABLE
requires actions within InnoDB, enforce the table options (MDEV-13851).
In this way, we will keep denying ADD SPATIAL INDEX for tables
that use encryption (MDEV-11974), even if ALGORITHM=INPLACE is used.
2017-09-20 16:53:34 +03:00
Vicențiu Ciorbaru
2d9f5f69d4 Merge branch '10.1' into 10.2 2017-09-20 10:46:09 +03:00
Vicențiu Ciorbaru
c9e111202e Merge branch '10.0' into 10.1 2017-09-20 10:35:11 +03:00
Vicențiu Ciorbaru
78f6f2b73b Merge branch 'bb-10.1-vicentiu' into 10.1 2017-09-20 10:25:51 +03:00
Vicențiu Ciorbaru
20d4cac6db Merge branch 'bb-10.0-vicentiu' into 10.0 2017-09-20 10:24:31 +03:00
Jan Lindström
0b9437951c MDEV-13850: Uninitialized variable at wsrep_binlog.cc:455 2017-09-20 09:57:39 +03:00
Oleksandr Byelkin
97c2a7354b MDEV-13290: Assertion Assertion !is_set() || (m_status == DA_OK_BULK && is_bulk_op())' or ! is_set()' failed
Check error status which can be set by conversion procedures.
2017-09-19 16:19:06 +02:00
Vicențiu Ciorbaru
a1e589be9b MDEV-13354: Server crashes in find_field_in_tables upon PS with window function and subquery
When creating an Item_direct_view_ref we were setting the
Name_resolution_context based on TABLE_LIST::view member variable.
However, for derived tables this member is NULL. To not set a wrong
context, if TABLE_LIST::view is empty, use THD::lex instead.
2017-09-19 15:14:10 +03:00
Vicențiu Ciorbaru
454b9b1bdc MDEV-13774: Server Crash on Execute of SQL Statement
Window functions can not be used as arguments to aggregate functions, as
the aggregation happens before window function computation. Disallow
such constructs by returning an error.

In order to detect this case a change was needed in the base
Item_sum_xxx::fix_fields to propagate the with_window_func flag.

Item_func_group_concat requires the same change.
2017-09-19 15:14:10 +03:00
Vicențiu Ciorbaru
33209350f7 MDEV-13649: Server crashes in set_field_to_null_with_conversions or in Field::set_notnull
Item_cond did not correctly propagate with_window_func flag in the Item
tree. Without it, we would not call Item::split_sum_func correctly and the
window function's result_field would remain NULL.
2017-09-19 15:14:10 +03:00
Vicențiu Ciorbaru
02eda36e4e MDEV-13358: FIRST_V throw SQL Fehler (1292): Incorrect datetime value
This is backport of 25ad623d64 for 10.2.

The issue is similar to the one from MDEV-13240. Item::save_in_field()
returns an error during tmp table population in a create table from select query
as we try to save an empty string as a date value when
force_return_blank is set to true for window functions.

    MDEV-13240 Wrong warning with MAX(datetime_field) OVER (...)

    The problem resided in Item_window_func implementation,
    and it was revealed by bb-10.2-ext specific changes:

    Item_window_func::save_in_field() works differently in bb-10.2-ext vs 10.2:

    - 10.2 goes through val_str()
    - bb-10.2-ext goes through get_date(), due to Type_handler related changes.
      get_date() tries to convert empty string to DATETIME, hence the warning.

    During a discussion with Vicentiu, it was decided to fix
    Item_window_func::val_xxx() to return NULL
    (instead of an "empty" value, such as 0 for numbers and '' for strings)
    when force_return_blank is set.
2017-09-19 15:14:10 +03:00
Vicențiu Ciorbaru
22c322c649 Merge branch '10.1' into 10.2 2017-09-19 12:43:02 +03:00
Vicențiu Ciorbaru
ec6042bda0 Merge branch '10.0' into 10.1 2017-09-19 12:06:50 +03:00
Vicențiu Ciorbaru
ba0ee91077 Merge branch '10.0-galera' into 10.1 2017-09-19 10:20:01 +03:00
Vicențiu Ciorbaru
0f44c8ab28 Fix merge error 2017-09-19 02:05:11 +03:00
Vicențiu Ciorbaru
d6a7de2022 Merge branch '5.5' into 10.0 2017-09-19 01:02:01 +03:00
Sergei Golubchik
a5ee77393f MDEV-13157 Specifying DATA DIRECTORY in tables leads to failing EXCHANGE PARTITION 2017-09-18 10:40:26 +02:00
Sergei Golubchik
55c5448ab7 MDEV-13751 Interrupted SELECT fails with 1030: 'Got error 1 "Operation not permitted" from storage engine MyISAM'
quick select returns 1, not proper HA_ERR_xxx error code,
so don't send it to handler::print_error().
2017-09-18 10:12:23 +02:00
Sergei Golubchik
fb2035a1a3 MDEV-13673 Bad result in view
When printing an expression, like a/(b*c), we need to print parentheses,
even though / and * have the same precedence. Basically, we should
always treat the second argument as having one level higher precedence
than it normally is.
2017-09-18 10:12:23 +02:00
Sergei Golubchik
16b1cb6502 MDEV-13623 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in virtual longlong Field_long::val_int
multi-update first runs a select to find affected rows, then performs
a separate update step. On the second step WITH CHECK OPTION rows
are read with rnd_read, but the first step might've been done with
keyread.

keyread over indexed virtual columns only reads the column's value, not
dependent base columns. This is reflected in the read_set too.  But on
the rnd_read step base columns must be read - thus we need to update the
read_set before doing updates.
2017-09-18 10:12:23 +02:00
Sergei Golubchik
4c6c352138 MDEV-13596 CHECK constraints disallow NULL to pass through, violating SQL
SQL Standard (4.23.3.4 Table check constraints, part 2, SQL:2016) says
that CHECK constraint rejects rows *only* if the condition is FALSE.
That is, both TRUE and NULL should be allowed.
2017-09-18 10:12:23 +02:00
Sergei Golubchik
8b1f145c82 cleanup
Item_func_format::print() was redundant
and other changes
2017-09-18 10:12:23 +02:00
Sergei Golubchik
3af191b7e1 compiler warning
thread_id is uint64 in 10.2
2017-09-18 10:12:23 +02:00
Sergei Golubchik
c4dc2b877a bugfix: TIME_FORMAT() should be ok in stored generated columns 2017-09-18 10:12:23 +02:00
Sergei Golubchik
3e5cdfae93 bugfix: TIME_FORMAT() allowed some non-time format specifiers
it contradicted the manual and was inconsistent
2017-09-18 10:12:23 +02:00
Sergei Golubchik
bba169b984 MDEV-12763 10.2 uses deprecated openssl 1.0 apis even with 1.1
Use OpenSSL 1.1 when applicable.
Create compatibility macros for OpenSSL 1.0- and YaSSL.
2017-09-18 10:12:23 +02:00
Sergei Golubchik
0757a1b3e2 bugfix: allow dropping a constraint and a column together
post-fix for 04b288ae47
2017-09-18 10:12:23 +02:00
Marko Mäkelä
429ca9a881 Merge 10.1 into 10.2 2017-09-18 11:10:21 +03:00
Marko Mäkelä
372dba097d Silence a -Wimplicit-fallthrough warning 2017-09-17 14:13:32 +03:00
Marko Mäkelä
d9277732d7 Merge 10.1 into 10.2
This should also fix the MariaDB 10.2.2 bug
MDEV-13826 CREATE FULLTEXT INDEX on encrypted table fails.

MDEV-12634 FIXME: Modify innodb-index-online, innodb-table-online
so that they will write and read merge sort files. InnoDB 5.7
introduced some optimizations to avoid using the files for small tables.

Many collation test results have been adjusted for MDEV-10191.
2017-09-17 11:05:33 +03:00
Marko Mäkelä
a07b537b39 Field_varstring: Declare get_data() and get_length() as public
The underlying data members are declared public, so there is no
point in hiding these const accessors.
2017-09-15 20:09:41 +03:00
Alexander Barkov
65d26d1f31 MDEV-10191 non convertible chars convert() resulted in Null instead "?" on Windows
The problem was introduced by the patch for MDEV-7661,
which (in addition to the fix itself) included an attempt to make
CONVERT/CAST work in the same way with fields
(i.e. return NULL in strict mode if a non-convertable character found).
It appeared to be a bad idea and some users were affected by this
behavior change. Changing CONVERT/CAST not depend on sql_mode
(restoring pre-10.1.4 behavior).
2017-09-15 20:59:04 +04:00
Alexander Barkov
434e283507 MDEV-13685 Can not replay binary log due to Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat' 2017-09-15 12:25:06 +04:00
sjaakola
a8b3c603c6 MW-394
* recorded new result file, original was copied from MariaDB
  which produces syntactically a bit different result
* semantics are same in MariaDB and ours result file
2017-09-15 09:45:55 +03:00
sjaakola
ed9f68f6ad MW-394
* changed thd_binlog_format to return configured binlog format in wsrep execution,
  regardless of binlogging setting (i.e. with or without binlogging)
* thd_binlog_format is used in innobase::write_row(), and would return confusing
  result there when log_bin==OFF
2017-09-15 09:22:54 +03:00
sjaakola
f3435fc37e MW-394
* ported the partition.test from MariaDB 10.3 code tree
* fix to TOI replicate ALTER TABLE EXCHANGE PARTITION statement
2017-09-15 09:09:26 +03:00
Alexander Barkov
250ca1c1d2 MDEV-13707 Server in ORACLE mode crashes on ALTER with wrong DEFAULT clause 2017-09-13 16:45:42 +04:00
Alexey Botchkov
dc82f70e9f MDEV-13633 JSON_ARRAY() - bad output with some UTF8 characters.
set_charset() calls added for Item_func_json_arran
        and Item_func_json_object::val_str-s.
2017-09-13 15:17:28 +04:00
Alexey Botchkov
a237a92099 MDEV-12877 Wrong result from JSON native function.
Set default charset for temporary paths so UDF call don't crash.
2017-09-13 00:36:09 +04:00
Alexey Botchkov
80a3837283 MDEV-12877 Wrong result from JSON native function.
JSON_QUOTE return type set to be JSON.
2017-09-12 19:15:31 +04:00