Commit graph

65870 commits

Author SHA1 Message Date
Monty
838205f0bb Fixed compiler warnings and test failures found by buildbot 2016-06-22 22:04:55 +03:00
Monty
34eb10e406 MDEV-10138 Support for decimals up to 38 digits
Decimals with float, double and decimal now works the following way:

- DECIMAL_NOT_SPECIFIED is used when declaring DECIMALS without a firm number
  of decimals.  It's only used in asserts and my_decimal_int_part.
- FLOATING_POINT_DECIMALS (31) is used to mark that a FLOAT or DOUBLE
  was defined without decimals. This is regarded as a floating point value.
- Max decimals allowed for FLOAT and DOUBLE is FLOATING_POINT_DECIMALS-1
- Clients assumes that float and double with decimals >= NOT_FIXED_DEC are
  floating point values (no decimals)
- In the .frm decimals=FLOATING_POINT_DECIMALS are used to define
  floating point for float and double (31, like before)

To ensure compatibility with old clients we do:

- When storing float and double, we change NOT_FIXED_DEC to
  FLOATING_POINT_DECIMALS.
- When creating fields from .frm we change for float and double
  FLOATING_POINT_DEC to NOT_FIXED_DEC
- When sending definition for a float/decimal field without decimals
  to the client as part of a result set we convert NOT_FIXED_DEC to
  FLOATING_POINT_DECIMALS.
- variance() and std() has changed to limit the decimals to
  FLOATING_POINT_DECIMALS -1 to not get the double converted floating point.
  (This was to preserve compatiblity)
- FLOAT and DOUBLE still have 30 as max number of decimals.

Bugs fixed:

variance() printed more decimals than we support for double values.

New behaviour:
- Strings now have 38 decimals instead of 30 when converted to decimal
- CREATE ... SELECT with a decimal with > 30 decimals will create a column
  with a smaller range than before as we are trying to preserve the number of
  decimals.


Other changes
- We are now using the obsolete bit FIELDFLAG_LEFT_FULLSCREEN to specify
  decimals > 31
- NOT_FIXED_DEC is now declared in one place
- For clients, NOT_FIXED_DEC is always 31 (to ensure compatibility).
  On the server NOT_FIXED_DEC is DECIMAL_NOT_SPECIFIED (39)
- AUTO_SEC_PART_DIGITS is taken from DECIMAL_NOT_SPECIFIED
- DOUBLE conversion functions are now using DECIMAL_NOT_SPECIFIED instead of
  NOT_FIXED_DEC
2016-06-22 22:04:55 +03:00
Sergey Vojtovich
5b008d4a27 Merge pull request #181 from ottok/ok-debpkg-10.2
General spell fixing in comments and strings
2016-06-14 16:43:08 +04:00
Nirbhay Choubey
b2ae32aafd MDEV-5535: Cannot reopen temporary table
Since a query can now refer to the same temporary table
multiple times, find_dup_table()/find_table_in_list()
have been updated to also consider this new possibility.
2016-06-10 18:39:44 -04:00
Nirbhay Choubey
e2087c6e8d MDEV-5535: Cannot reopen temporary table
Temporary table being created by outer statement
should not be visible to inner statement. And if
inner statement creates a table with same name.
The whole statement should fail with
ER_TABLE_EXISTS_ERROR.

Implemented by temporarily de-linking the TABLE_SHARE
being created by outer statement so that it remains
hidden to the inner statement.
2016-06-10 18:39:43 -04:00
Nirbhay Choubey
7305be2f7e MDEV-5535: Cannot reopen temporary table
mysqld maintains a list of TABLE objects for all temporary
tables created within a session in THD. Here each table is
represented by a TABLE object.

A query referencing a particular temporary table for more
than once, however, failed with ER_CANT_REOPEN_TABLE error
because a TABLE_SHARE was allocate together with the TABLE,
so temporary tables always had only one TABLE per TABLE_SHARE.

This patch lift this restriction by separating TABLE and
TABLE_SHARE objects and storing TABLE_SHAREs for temporary
tables in a list in THD, and TABLEs in a list within their
respective TABLE_SHAREs.
2016-06-10 18:39:43 -04:00
Nirbhay Choubey
547511153f MDEV-5535: Cannot reopen temporary table
Add generic temporary table related tests.
2016-06-10 18:00:23 -04:00
Sergei Golubchik
2dee76f435 MDEV-9518 Increase the range for INFORMATION_SCHEMA.MEMORY_USED column
make INFORMATION_SCHEMA.PROCESSLIST.MEMORY_USED bigint
2016-06-09 00:00:44 +02:00
Otto Kekäläinen
effbe7dd7b General spell fixing in comments and strings 2016-06-08 14:17:23 +03:00
Sergei Golubchik
69da361ccd reset @@TIMESTAMP for COM_CHANGE_USER
this also fixes tokudb.type_year failure
(in ./mtr tokudb.type_timestamp tokudb.type_year)
2016-06-04 09:06:00 +02:00
Alexander Barkov
54332b2793 Adding more tests for VIEWs with UNION. 2016-06-02 10:00:00 +04:00
Vladislav Vaintroub
22ede741f0 fix compile error - inconsistent use of 'struct' and 'class' for TDC_element 2016-06-01 20:21:36 +02:00
Nirbhay Choubey
23fed78404 MDEV-6368: assertion xid_seqno > trx_sys_cur_xid_seqno (postfix)
- Fix build failure when built without wsrep (Win)
- Update the expected warning in sys_vars.wsrep_start_position
2016-06-01 13:15:38 -04:00
Alexander Barkov
286416404a MDEV-10101 Wrong error message of SELECT 1 UNION (SELECT 1 FROM t1 GROUP BY 1 WITH ROLLUP) 2016-06-01 15:31:26 +04:00
Alexander Barkov
caee832df1 MDEV-10124 Incorrect usage of CUBE/ROLLUP and ORDER BY with GROUP_CONCAT(a ORDER BY a)
Allowing GROUP_CONCAT(... ORDER BY ..) in queries with ROLLUP.

The story of the related code:

1. The original patch from Wax
commit: 0b505fb437
date: Tue Mar 18 03:07:40 2003

opt_gorder_clause reused the regular order_clause,
which already had some protection against ROLLUP queries:

order_clause:
        ORDER_SYM BY
        {
          LEX *lex=Lex;
          if (lex->current_select->linkage != GLOBAL_OPTIONS_TYPE &&
              lex->current_select->select_lex()->olap !=
              UNSPECIFIED_OLAP_TYPE)
          {
            net_printf(lex->thd, ER_WRONG_USAGE,
                       "CUBE/ROLLUP",
                       "ORDER BY");
            YYABORT;
          }
        } order_list;

The assumption that ORDER BY in group_concat() had to have
the same ROLLUP restriction (with order_clause) was wrong.

Moreover, GROUP_CONCAT() in select_item_list was not affected
by this restriction, because WITH ROLLUP goes after
select_item_list and therefore sel->olap is always equal
to UNSPECIFIED_OLAP_TYPE during select_item_list.

GROUP BY was not affected for two reasons:
- it goes before WITH ROLLUP and sel->olap is still
  UNSPECIFIED_OLAP_TYPE
- Aggregate functions like AVG(), GROUP_CONCAT() in GROUP BY
  are not allowed

So only GROUP_CONCAT() in HAVING and ORDER BY clauses
were erroneously affected by this restriction.

2. Bug#27848 rollup in union part causes error with order of union
commit: 3f6073ae63
Author: unknown <igor@olga.mysql.com>  2007-12-15 01:42:46

The condition in the ROLLUP protection code became more complex.
Note, opt_gconcat_order still reused the regular order_clause.

3. Bug#16347426 ASSERTION FAILED: (SELECT_INSERT &&
                 !TABLES->NEXT_NAME_RESOLUTION_TABLE) || !TAB
commit: 2d83663380
author: Chaithra Gopalareddy <chaithra.gopalareddy@oracle.com>
date: 2013-04-14 06:00:49

opt_gorder_clause was refactored not to use order_clause and
to collect information directly to select->gorder_list.
The ROLLUP protection code was duplicated from order_clause
to the new version of opt_gorder_clause.
2016-06-01 14:29:20 +04:00
Nirbhay Choubey
de7eafc7ce MDEV-6368: assertion xid_seqno > trx_sys_cur_xid_seqno
- Validate the specified wsrep_start_position value by also
checking the return status of wsrep->sst_received. This also
ensures that changes in wsrep_start_position is not allowed
when the node is not in JOINING state.
- Do not allow decrease in seqno within same UUID.
- The initial checkpoint in SEs should be [0...:-1].
2016-05-31 20:37:00 -04:00
Elena Stepanova
7013f86e40 Follow-up for the previous commit - result change for a big test 2016-05-30 00:12:50 +03:00
Oleksandr Byelkin
7166069537 MDEV-3944: Allow derived tables in VIEWS 2016-05-28 14:44:21 +02:00
Alexander Barkov
971538f4c2 Adding various tests for combinations of
UNION, ROLLUP, GROUP_CONCAT, for better coverage.
2016-05-25 11:00:06 +04:00
Alexander Barkov
2fc6e79084 Recording test results forgotten in 9a25c01f78
MDEV-10102 Disallow CREATE VIEW .. PROCEDURE ANALYSE() syntactically
2016-05-25 06:47:09 +04:00
Alexander Barkov
c80c3f6759 MDEV-10109 Disallow syntactically INSERT .. SELECT .. {ORDER BY ..| LIMIT ..} .. UNION .. 2016-05-24 18:05:38 +04:00
Alexander Barkov
ea9a393a86 MDEV-10103 Disallow syntactically UNION SELECT .. PROCEDURE ANALYSE() 2016-05-24 14:18:46 +04:00
Alexander Barkov
9a25c01f78 MDEV-10102 Disallow CREATE VIEW .. PROCEDURE ANALYSE() syntactically 2016-05-23 16:25:51 +04:00
Alexander Barkov
4c0e2960d4 MDEV-10051 Fix subselect to return a syntax error instead of "Incorrect usage of UNION and LIMIT" 2016-05-23 10:54:09 +04:00
Alexander Barkov
a999acf26e MDEV-10095 Fix derived tables to return a syntax error instead of "Illegal usage of UNION and LIMIT" 2016-05-21 16:52:12 +04:00
Oleksandr Byelkin
485ece6da9 MDEV-8429: Change binlog_checksum default to match MySQL 5.6.6+ 2016-05-20 09:46:03 +02:00
Alexander Barkov
f6a7c1c75a MDEV-10080 Derived tables allow double LIMIT clause
1. Moving the "| get_select_lex_derived select_derived_init" part of
select_derived into a separate new rule derived_query_specification.
2. Using derived_query_specification directly in select_derived_union
rather than in select_derived.
3. Moving the sequence "opt_order_clause opt_limit_clause opt_select_lock_type"
from select_derived2 to select_derived_union,
after derived_query_specification.

Effectively, the parser now does not go through the sequence
"opt_order_clause opt_limit_clause ... opt_union_order_or_limit" any more.

This fixes the problem with double LIMIT clause and removes 2 shift/reduce
conflicts.
2016-05-20 09:21:07 +04:00
Alexander Barkov
7e66a24dfb MDEV-10079 sql_yacc.yy: Remove non-parenthesized SELECT from table_ref 2016-05-17 13:41:39 +04:00
Igor Babaev
4a8d377171 Fixed bug mdev-10058.
This was a bug in the parser. As a result it could accept queries
with invalid derived tables if they used With clauses.
2016-05-16 20:19:04 -07:00
Alexander Barkov
612267301f MDEV-10036 sql_yacc.yy: Split select_part2 to disallow syntactically bad constructs with INTO, PROCEDURE, UNION
MDEV-10037 UNION with LIMIT ROWS EXAMINED does not require parentheses
2016-05-10 11:48:01 +04:00
Alexander Barkov
c0a59b46be MDEV-10030 sql_yacc.yy: Split table_expression and remove PROCEDURE from create_select, select_paren_derived, select_derived2, query_specification
This change refactors the "table_expression" rule in sql_yacc.yy.

Queries with subselects and derived tables, as well as "CREATE TABLE ... SELECT"
now return syntax error instead of "Incorrect usage of PROCEDURE and ...".
2016-05-06 11:42:48 +04:00
Sergey Vojtovich
7905ea8904 MDEV-6720 - enable connection log in mysqltest by default
This is an addition to original patch. Removed meaningless
"echo SET SESSION AUTOCOMMIT=0" (transaction is started explicitely on
master anyway).
2016-05-05 11:20:37 +04:00
Monty
5a7374d71b Fixed test cases that broke because we now print changing of connections
- Don't log connection creation in galera_connect.inc
2016-05-01 19:10:13 +03:00
Daniel Black
aed1485b99 MDEV-9758: correct test case 2016-04-29 18:41:00 +02:00
Daniel Black
51a66299f3 CHECKSUM TABLE to calculate in multiple column chunks
Checksum implementations contain optimizations for calculating
checksums of larger blocks of memory.

This optimization calls my_checksum on a larger block of memory
rather than calling on multiple adjacent memory as its going though
the table columns for each table row.
2016-04-29 18:41:00 +02:00
Vladislav Vaintroub
8b94aec11a Fix connect2 test, simulated errors do not work with thread cache 2016-04-28 22:25:11 +02:00
Monty
9c846373f0 Merge commit 'd5822a3ad0657040114cdc185c6387b9eb3a12b2' into 10.2 2016-04-28 16:59:33 +03:00
Monty
d5822a3ad0 Fixed some galera tests 2016-04-28 16:30:34 +03:00
Monty
48f02af761 MDEV-9602 crash in st_key::actual_rec_per_key when group by constant
Problem was that cost_group_min_max() could not handle if group by was optimized away.
2016-04-28 13:39:55 +03:00
Alexey Botchkov
47e0717806 MDEV-9792 Backport MDEV-8713 to 10.1. 2016-04-27 11:08:46 +04:00
Igor Babaev
3b6a64c247 Fixed bug mdev-9937.
When the specification of a WITH table referred to a view
that used a based table with the same name as the WITH table
the server went into an infinite loop because it erroneously
resolved the reference to the base table as the reference to
the WITH table.

With tables used in a view cannot be searched for beyond the
scope the view.
2016-04-20 10:55:53 -07:00
Sergei Petrunia
4b8e54bb98 MDEV-7885, MDEV-8857: Add testcases
The issues themselves were fixed as part of MDEV-8646
2016-04-17 13:25:05 -07:00
Sergei Petrunia
957809b190 MDEV-9922: Assertion `!join->only_const_tables() && fsort' failed
When join output is just one row, we still need to compute window
function values for it. We could skip invoking filesort for it,
but it doesn't seem to be worth it to do such optimization.
2016-04-16 20:41:06 +03:00
Sergei Petrunia
a81e711a06 MDEV-9925: Wrong result with aggregate function as a window function
Make Frame_range_current_row_bottom to take into account partition bounds.

Other partition bounds that could potentially hit the end of partition are
Frame_range_n_bottom, Frame_n_rows_following, Frame_unbounded_following,
and they all had end-of-partition protection.

To simplify the code, factored out end-of-partition checks into
class Partition_read_cursor.
2016-04-15 20:40:01 +03:00
Sergei Petrunia
d29e1472fb Make test result deterministic. 2016-04-15 17:48:40 +03:00
Igor Babaev
bc6df8d6e0 Merge branch 'bb-10.2-mdev9543' of github.com:MariaDB/server into bb-10.2-mdev9543 2016-04-14 01:08:54 -07:00
Igor Babaev
5ff4b21e02 Fixed bug mdev-9897.
This bug revealed a serious problem: if the same partition list
was used in two window specifications then the temporary table created
to calculate window functions contained fields for two identical
partitions. This problem was fixed as well.
2016-04-14 00:47:28 -07:00
Vicențiu Ciorbaru
3dd08a11de Fix another bug in dense_rank.
When ordering by a column and partitioning by another, we must reset the
peer_tracker for dense_rank, regardless if the value for the order
column changes or not.

Example:
select a, b, dense_rank() over (partition by b order by a)
a  |  b  |  dense_rank
----------------------
1  | p1  |           1
2  | p1  |           2
2  | p2  |           1   // Here, without this fix we returned 0.
2  | p2  |           2   // And 1 here.
2016-04-13 10:39:06 +02:00
Sergei Petrunia
b532be9f8c Merge ../10.2-window-funcs-r12 into 10.2 2016-04-12 00:00:53 +02:00
Vicențiu Ciorbaru
419c925069 Fix dense_rank returning minimum rank of 2 when using null columns.
The bug was caused by a weird behaviour in test_if_group_changed, not
returning true when testing for the first time after initializing
the Cached_item list.
2016-04-11 10:46:58 +02:00