Commit graph

65107 commits

Author SHA1 Message Date
Sergei Golubchik
5c764a0eb8 clarify ER_CANT_DROP_FIELD_OR_KEY
include the dropped object type
2016-07-02 14:52:20 +02:00
Sergei Golubchik
06acd7a2fc don't save vcol flags in frm
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.
2016-07-01 22:30:09 +02:00
Sergei Golubchik
c3e06381ab cannot use item->const_item() in open_table_from_share()
because table->map is set much later.
Use check_vcol_func_processor() to detect fields too.
2016-07-01 22:30:09 +02:00
Alexander Barkov
675d8a94f5 Removing the "thd" argument from Item::create_field_for_create_select().
"thd" is available through the "table" argument, as table->in_use.
2016-07-01 21:45:57 +04:00
Sergei Golubchik
ffac85482b MDEV-8989 ORDER BY optimizer ignores equality propagation
Restore the fix from the commit 99cd5a9 that was lost in a merge.
2016-07-01 16:44:17 +02:00
Sergei Golubchik
932646b1ff Merge branch '10.1' into 10.2 2016-06-30 16:38:05 +02:00
Sergei Golubchik
20dbfbb49c vcols: store flags first 2016-06-30 11:43:02 +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
3687edeec9 clarify the order of evaluation for INSERT 2016-06-30 11:43:02 +02:00
Sergei Golubchik
f93a2a3b3b various cleanups
* 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
2016-06-30 11:43:02 +02:00
Sergei Golubchik
047d762d51 move all new 10.2 error codes to start from 4000 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
7039077195 change vcol->non_deterministic to vcol->flags 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
ed77ee1aab cleanup: change Item::walk() to take void* not uchar*
and remove all related casts to uchar*
also remove a couple of unused methods
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
Sergei Golubchik
99e48cb1d9 restore ER_VIEW_CHECK_FAILED to be different from ER_CONSTRAINT_FAILED
collaterals:
* use %`s, not '%s'
* use correct SQLSTATE codes for these two errors
2016-06-30 11:43:02 +02:00
Alexander Barkov
4dcbb775ae parentheses in default
- Adding SHOW CREATE TABLE into all DEFAULT tests,
  to cover need_parentheses_in_default() for all items
- Fixing a few items not to print parentheses in DEFAULT:
  spatial function-alike predicates, IS_IPV4 and IS_IPV6 functions,
  COLUMN_CHECK() and COLUMN_EXISTS().
2016-06-30 11:43:02 +02:00
Alexander Barkov
b3e11d33db Adding a comment why we need column_default_non_parenthesized_expr
(a new rule in sql_yacc.yy)
2016-06-30 11:43:02 +02:00
Michael Widenius
fb67cde237 Use default character set for expressions
- 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
2016-06-30 11:43:02 +02:00
Alexander Barkov
6c626117e7 More test for MDEV-10134 Add full support for DEFAULT
Miscelaneous functions:
BENCHMARK(), SLEEP(), ROW_COUNT(), FOUND_ROWS(),
GET_LOCK(), RELEASE_LOCK(), IS_USED_LOCK(), IS_FREE_LOCK(),
MASTER_POS_WAIT(), MASTER_GTID_WAIT(), BINLOG_GTID_POS(),
ST_GIS_DEBUG(), DECODE_HISTOGRAM(),
2016-06-30 11:43:02 +02:00
Alexander Barkov
3f32bf627f More tests for "MDEV-7563 Support CHECK constraint".
Testing non-ASCII string literals.
2016-06-30 11:43:02 +02:00
Monty
d99994a460 Ensure we print the most importaint violating function 2016-06-30 11:43:02 +02:00
Michael Widenius
2fe8dd0f90 various cleanups 2016-06-30 11:43:02 +02:00
Michael Widenius
db7edfed17 MDEV-7563 Support CHECK constraint as in (or close to) SQL Standard
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
2016-06-30 11:43:02 +02:00
Sergei Golubchik
23d03a1b1e parse negative numbers into one item
use Item->neg to convert generate negative Item_num's
instead of Item_func_neg(Item_num).

Based on the following commit:

  Author: Monty <monty@mariadb.org>
  Date:   Mon May 30 22:44:00 2016 +0300

    Make negative number their own token
    The negation (-) operator will call Item->neg() one underlying numeric constants
    and remove itself (like the NOT() function does today for other NOT functions.

    This simplifies things
    - -1 is not anymore an expression but a basic_const_item
      - improves optimizer
      - DEFAULT -1 doesn't need special handling anymore
      - When we add DEFAULT expressions, -1 will be treated exactly like 1
    - printing of items doesn't anymore put braces around all negative numbers

    Other things fixed:
    - Fixed that longlong converted to decimal's has a more appropriate size
    - Fixed that "-0.0" read into a decimal is interpreted as 0.0
2016-06-30 11:43:02 +02:00
Monty
60916a8b9e Simplify THD::decide_logging_format()
Fixed some test for future when DELETE will not trigger row based replication
2016-06-30 11:43:02 +02:00
Michael Widenius
6c173324ff Part of MDEV-10134 Add full support for DEFAULT
Print default values for BLOB's.
This is a part commit for automatic changes to make the real commit smaller.
All changes here are related to that we now print DEFAULT NULL for blob and
text fields, like we do for all other fields.
2016-06-30 11:43:02 +02:00
Sergei Golubchik
3aadba1557 compilation warning 2016-06-30 11:43:02 +02:00
Alexander Barkov
afbd28aeff Preparing the CAST(..AS [UN]SIGNED) related code to fix a number
of bugs easier (MDEV-8919, MDEV-10304, MDEV-10305, MDEV-10307)

- Adding Item::push_note_converted_to_negative_complement() and
  Item::push_note_converted_to_positive_complement()
- Adding virtual methods Item::val_int_signed_typecast() and
  Item::val_int_unsigned_typecast()
- Moving COLUMN_GET() related code from
  Item_func_signed::val_int() and Item_func_unsigned::val_int() to
  Item_dyncol_get::val_int_signed_typecast() and
  Item_dyncol_get::val_int_unsigned_typecast()
- Moving Item_func_signed::val_int_from_str() to Item::val_int_from_str()
  and changing it to get the value from "this" instead of args[0].

The patch does not change behaviour. It's only to simplify fixing of the
mentioned bugs. It will also simplify switching the CAST related code to
use the type handler infrastructure easier (soon).
2016-06-29 18:25:51 +04:00
Sergei Golubchik
341e5f4411 MDEV-10054 Secure login fails when CIPHER is required
SSL: do not require client certificate to exist,
if GRANT didn't require that
2016-06-28 22:33:15 +02:00
Sergei Golubchik
62e0a4552f Merge branch '10.0-galera' into 10.1 2016-06-28 22:06:22 +02:00
Sergei Golubchik
3361aee591 Merge branch '10.0' into 10.1 2016-06-28 22:01:55 +02:00
Sergei Golubchik
6ce20fb2b9 MDEV-9428 NO_AUTO_VALUE_ON_ZERO is ignored when a trigger before insert is defined
fix the *other* fill_record() too, arrgh!
2016-06-28 12:54:01 +02:00
Sergei Golubchik
0fdb17e6c3 Merge branch '5.5' into 10.0 2016-06-28 11:25:59 +02:00
Alexander Barkov
56a3496067 MDEV-10236 Where expression with NOT function gives incorrect result
Item_cache::is_null() erroneously returned null_value in a
non-cached state. Now Item_cache::is_null() uses has_value(),
which caches the value if not cached yet, similar to what other value methods do
(e.g. val_int, val_real, etc).
2016-06-28 13:11:04 +04:00
Nirbhay Choubey
7ff44b1a83 MDEV-10161: wsrep_sync_wait not enabled when set to 1 in config file
Since wsrep_sync_wait & wsrep_causal_reads variables are related,
they are always kept in sync whenever one of them changes.
Same is tried on server start, where wsrep_sync_wait get updated
based on wsrep_causal_reads' value. But, since wsrep_causal_reads
is OFF by default, wsrep_sync_wait's value gets modified and loses
its WSREP_SYNC_WAIT_BEFORE_READ bit.

Fixed by syncing wsrep_sync_wait & wsrep_causal_reads values
individually on server start in mysqld_get_one_option() based
on command line arguments used.
2016-06-27 18:30:07 -04:00
Nirbhay Choubey
90f222ea7d MDEV-10235: Deadlock in CREATE TABLE .. AS SELECT .. if result set is empty in Galera
In CTAS, handlers get registered under statement transaction
(st_transactions::stmt), while ha_fake_trx_id(), used by CTAS,
looked under standard transaction (st_transactions::all) for
registered handlers, and thus it failed to grab a fake transaction
ID. As a result, with no valid transaction ID, wsrep commit failed
with an error.

ha_fake_trx_id() now looks for handlers registered under 'stmt'
in case 'all' is empty. Also modified the logic to print warning
only once if none of the registered handlers have fake_trx_id.
2016-06-27 18:21:00 -04:00
Nirbhay Choubey
48a0a66ffa MDEV-10186: mysqld crash when runtime setting wsrep_cluster_address without wsrep_on=ON
On wsrep_cluster_address update, node restarts the replication
and attempts to connect to the new address. In this process it
makes a call to wsrep provider's connect API, which could lead
to segfault if wsrep provider is not loaded (wsrep_on=OFF).

Fixed by making sure that it proceeds only if a provider is
loaded.
2016-06-27 18:15:47 -04:00
Nirbhay Choubey
7f9fcfe00e Code cleanup (wsrep patch). 2016-06-27 18:07:43 -04:00
Nirbhay Choubey
2768829e53 MDEV-10056: SST method mysqldump is broken
errno must be reset before strtol()/strtoll() functions
are invoked.
2016-06-27 17:59:12 -04:00
Nirbhay Choubey
b57232d3cb MDEV-6699 : wsrep_node_name not automatically set to hostname
Fixed by using hostname (glob_hostname) as default value for
wsrep_node_name system variable.
Added a test case.
2016-06-27 17:56:59 -04:00
Alexey Botchkov
09d902d84b MDEV-9618 solaris sparc build fails on 10.1.
Compiler on Sparc is strict about the 'const' modifiers
    in function declarations and definitions. Meaning
    they should be exactly same.
2016-06-27 18:02:28 +04:00
Alexander Barkov
652e799a38 MDEV-8502 DECIMAL accepts out of range DEFAULT values
MDEV-10277 Redundant NOTE when inserting '0.00001 ' into a DECIMAL(2,1) column
2016-06-27 15:14:07 +04:00
Nirbhay Choubey
14d62505d9 Merge tag 'mariadb-10.0.26' into 10.0-galera 2016-06-24 12:01:22 -04:00
Oleksandr Byelkin
79f852a069 MDEV-10050: Crash in subselect
thd should not be taken earlier then fix_field and reset on fix_fields if it is needed.
2016-06-24 14:15:35 +02:00
Monty
4dc5075860 Fixed compiler warnings and test failures found by buildbot
Fixed ccfilter to detect errors where the column is included in the error message
2016-06-24 02:25:14 +03:00
Sergey Vojtovich
4abeebeed7 MDEV-9728 - Hard crash in metadata_lock_info
Reverted APC based fix. APC subsystem is not ready to serve metadata_lock_info
needs.
2016-06-23 12:06:16 +04:00
Sergei Petrunia
3e03b89b0a MDEV-10185: Assertion `tree1->keys[key_no] && tree2->keys[key_no]' failed in
Make tree_or set correct SEL_TREE::keys_map for the result.
2016-06-22 23:20:41 +03:00