Skip to content

Commit bc14519

Browse files
committed
Merge 10.1 into 10.2
2 parents 1f1a61c + bfb0726 commit bc14519

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1186
-114
lines changed

client/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
2-
# Copyright (c) 2008, 2018, MariaDB Corporation
2+
# Copyright (c) 2008, 2019, MariaDB Corporation
33
#
44
# This program is free software; you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by

man/mysql_install_db.1

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'\" t
22
.\"
3-
.TH "\FBMYSQL_INSTALL_DB\" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System"
3+
.TH "\FBMYSQL_INSTALL_DB\FR" "1" "4 April 2019" "MariaDB 10\&.2" "MariaDB Database System"
44
.\" -----------------------------------------------------------------
55
.\" * set default formatting
66
.\" -----------------------------------------------------------------
@@ -198,6 +198,21 @@ Must be given as first option\&.
198198
.sp -1
199199
.IP \(bu 2.3
200200
.\}
201+
.\" mysql_install_db: defaults-group-suffix option
202+
.\" defaults-group-suffix option: mysql_install_db
203+
\fB\-\-defaults\-group\-suffix=\fR\fB\fIname\fR\fR
204+
.sp
205+
In addition to the given groups, also read groups with this suffix\&.
206+
.RE
207+
.sp
208+
.RS 4
209+
.ie n \{\
210+
\h'-04'\(bu\h'+03'\c
211+
.\}
212+
.el \{\
213+
.sp -1
214+
.IP \(bu 2.3
215+
.\}
201216
.\" mysql_install_db: force option
202217
.\" force option: mysql_install_db
203218
\fB\-\-force\fR
@@ -354,7 +369,7 @@ For internal use\&. This option is used for creating Windows distributions\&.
354369
.SH "COPYRIGHT"
355370
.br
356371
.PP
357-
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
372+
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
358373
.PP
359374
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
360375
.PP

mysql-test/r/gis-precise.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,10 @@ GEOMETRYFROMTEXT('POINT(4599 60359)'),
505505
) as relate_res;
506506
relate_res
507507
0
508+
prepare s from 'do st_convexhull(st_aswkb(multipoint(point(-11702,15179),point(-5031,27960),point(-30557,11158),point(-27804,30314))))';
509+
execute s;
510+
execute s;
511+
deallocate prepare s;
508512
with cte1 as( select (st_symdifference(point(1,1),point(1,1))) as a1 ), cte2 as(select 1 as a2) select 1 from cte1 where cte1.a1 < '1';
509513
1
510514
1

mysql-test/r/olap.result

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,5 +786,61 @@ t COUNT(*)
786786
12:12:13 1
787787
DROP TABLE t1;
788788
#
789+
# MDEV-17830 Server crashes in Item_null_result::field_type upon SELECT with CHARSET(date) and ROLLUP
790+
#
791+
# Note, different MariaDB versions can return different results
792+
# in the two rows (such as "latin1" vs "binary"). This is wrong.
793+
# Both lines should return equal values.
794+
# The point in this test is to make sure it does not crash.
795+
# As this is a minor issue, bad result will be fixed
796+
# in a later version, presumably in 10.4.
797+
CREATE TABLE t (d DATE) ENGINE=MyISAM;
798+
INSERT INTO t VALUES ('2018-12-12');
799+
SELECT CHARSET(d) AS f FROM t GROUP BY d WITH ROLLUP;
800+
f
801+
binary
802+
binary
803+
DROP TABLE t;
804+
#
805+
# MDEV-14041 Server crashes in String::length on queries with functions and ROLLUP
806+
#
807+
CREATE TABLE t1 (i INT);
808+
INSERT INTO t1 VALUES (1),(2);
809+
SELECT GET_LOCK( 'foo', 0 );
810+
GET_LOCK( 'foo', 0 )
811+
1
812+
SELECT HEX( RELEASE_LOCK( 'foo' ) ) AS f FROM t1 GROUP BY f WITH ROLLUP;
813+
f
814+
NULL
815+
1
816+
NULL
817+
DROP TABLE t1;
818+
CREATE TABLE t1 (i INT);
819+
INSERT INTO t1 VALUES (1),(2);
820+
SELECT i FROM t1 GROUP BY i WITH ROLLUP
821+
UNION ALL
822+
SELECT ELT( FOUND_ROWS(), 1 ) f FROM t1 GROUP BY f WITH ROLLUP;
823+
i
824+
1
825+
2
826+
NULL
827+
NULL
828+
NULL
829+
DROP TABLE t1;
830+
CREATE TABLE t1 (a INT);
831+
INSERT INTO t1 VALUES (1),(2);
832+
SELECT a FROM t1 GROUP BY NULLIF( CONVERT('', DATE), '2015-10-15' ) WITH ROLLUP;
833+
a
834+
1
835+
1
836+
Warnings:
837+
Warning 1292 Incorrect datetime value: ''
838+
Warning 1292 Incorrect datetime value: ''
839+
Warning 1292 Incorrect datetime value: ''
840+
Warning 1292 Incorrect datetime value: ''
841+
Warning 1292 Incorrect datetime value: ''
842+
Warning 1292 Incorrect datetime value: ''
843+
DROP TABLE t1;
844+
#
789845
# End of 10.1 tests
790846
#

mysql-test/r/sp.result

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7643,6 +7643,22 @@ c1 c2 count(c3)
76437643
2012-03-01 02:00:00 3 1
76447644
DROP PROCEDURE p1;
76457645
# End of 5.5 test
7646+
CREATE PROCEDURE sp() ALTER TABLE non_existing_table OPTIMIZE PARTITION p0;
7647+
CALL sp;
7648+
Table Op Msg_type Msg_text
7649+
test.non_existing_table optimize Error Table 'test.non_existing_table' doesn't exist
7650+
test.non_existing_table optimize status Operation failed
7651+
SELECT 1;
7652+
1
7653+
1
7654+
DROP PROCEDURE sp;
7655+
CREATE PROCEDURE sp() SHOW USER_STATISTICS;
7656+
CALL sp;
7657+
User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_read Rows_sent Rows_deleted Rows_inserted Rows_updated Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries Total_ssl_connections Max_statement_time_exceeded
7658+
SELECT 1;
7659+
1
7660+
1
7661+
DROP PROCEDURE sp;
76467662
#
76477663
# Bug#12663165 SP DEAD CODE REMOVAL DOESN'T UNDERSTAND CONTINUE HANDLERS
76487664
#

mysql-test/r/stat_tables.result

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,76 @@ MAX(pk)
625625
NULL
626626
DROP TABLE t1;
627627
#
628+
# MDEV-17605: SHOW INDEXES with use_stat_tables='preferably'
629+
#
630+
set use_stat_tables='preferably';
631+
CREATE DATABASE dbt3_s001;
632+
use dbt3_s001;
633+
set @save_optimizer_switch=@@optimizer_switch;
634+
set optimizer_switch='extended_keys=off';
635+
select * from mysql.table_stats;
636+
db_name table_name cardinality
637+
dbt3_s001 lineitem 6005
638+
select * from mysql.index_stats;
639+
db_name table_name index_name prefix_arity avg_frequency
640+
dbt3_s001 lineitem PRIMARY 1 4.0033
641+
dbt3_s001 lineitem PRIMARY 2 1.0000
642+
dbt3_s001 lineitem i_l_shipdate 1 2.6500
643+
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
644+
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
645+
dbt3_s001 lineitem i_l_partkey 1 30.0250
646+
dbt3_s001 lineitem i_l_suppkey 1 600.5000
647+
dbt3_s001 lineitem i_l_receiptdate 1 2.6477
648+
dbt3_s001 lineitem i_l_orderkey 1 4.0033
649+
dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033
650+
dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404
651+
dbt3_s001 lineitem i_l_commitdate 1 2.7160
652+
SHOW INDEXES FROM lineitem;
653+
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
654+
lineitem 0 PRIMARY 1 l_orderkey A 1500 NULL NULL BTREE
655+
lineitem 0 PRIMARY 2 l_linenumber A 6005 NULL NULL BTREE
656+
lineitem 1 i_l_shipdate 1 l_shipDATE A 2266 NULL NULL YES BTREE
657+
lineitem 1 i_l_suppkey_partkey 1 l_partkey A 200 NULL NULL YES BTREE
658+
lineitem 1 i_l_suppkey_partkey 2 l_suppkey A 699 NULL NULL YES BTREE
659+
lineitem 1 i_l_partkey 1 l_partkey A 200 NULL NULL YES BTREE
660+
lineitem 1 i_l_suppkey 1 l_suppkey A 10 NULL NULL YES BTREE
661+
lineitem 1 i_l_receiptdate 1 l_receiptDATE A 2268 NULL NULL YES BTREE
662+
lineitem 1 i_l_orderkey 1 l_orderkey A 1500 NULL NULL BTREE
663+
lineitem 1 i_l_orderkey_quantity 1 l_orderkey A 1500 NULL NULL BTREE
664+
lineitem 1 i_l_orderkey_quantity 2 l_quantity A 5771 NULL NULL YES BTREE
665+
lineitem 1 i_l_commitdate 1 l_commitDATE A 2210 NULL NULL YES BTREE
666+
SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name='lineitem';
667+
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
668+
def dbt3_s001 lineitem 0 dbt3_s001 PRIMARY 1 l_orderkey A 1500 NULL NULL BTREE
669+
def dbt3_s001 lineitem 0 dbt3_s001 PRIMARY 2 l_linenumber A 6005 NULL NULL BTREE
670+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_shipdate 1 l_shipDATE A 2266 NULL NULL YES BTREE
671+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_suppkey_partkey 1 l_partkey A 200 NULL NULL YES BTREE
672+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_suppkey_partkey 2 l_suppkey A 699 NULL NULL YES BTREE
673+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_partkey 1 l_partkey A 200 NULL NULL YES BTREE
674+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_suppkey 1 l_suppkey A 10 NULL NULL YES BTREE
675+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_receiptdate 1 l_receiptDATE A 2268 NULL NULL YES BTREE
676+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_orderkey 1 l_orderkey A 1500 NULL NULL BTREE
677+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_orderkey_quantity 1 l_orderkey A 1500 NULL NULL BTREE
678+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_orderkey_quantity 2 l_quantity A 5771 NULL NULL YES BTREE
679+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_commitdate 1 l_commitDATE A 2210 NULL NULL YES BTREE
680+
SELECT
681+
COUNT(DISTINCT l_orderkey), COUNT(DISTINCT l_orderkey,l_linenumber),
682+
COUNT(DISTINCT l_shipDATE),
683+
COUNT(DISTINCT l_partkey), COUNT(DISTINCT l_partkey,l_suppkey),
684+
COUNT(DISTINCT l_suppkey), COUNT(DISTINCT l_receiptDATE),
685+
COUNT(DISTINCT l_orderkey, l_quantity), COUNT(DISTINCT l_commitDATE)
686+
FROM lineitem;
687+
COUNT(DISTINCT l_orderkey) COUNT(DISTINCT l_orderkey,l_linenumber) COUNT(DISTINCT l_shipDATE) COUNT(DISTINCT l_partkey) COUNT(DISTINCT l_partkey,l_suppkey) COUNT(DISTINCT l_suppkey) COUNT(DISTINCT l_receiptDATE) COUNT(DISTINCT l_orderkey, l_quantity) COUNT(DISTINCT l_commitDATE)
688+
1500 6005 2266 200 700 10 2268 5772 2211
689+
set optimizer_switch=@save_optimizer_switch;
690+
DROP DATABASE dbt3_s001;
691+
USE test;
692+
delete from mysql.table_stats;
693+
delete from mysql.column_stats;
694+
delete from mysql.index_stats;
695+
set @save_optimizer_switch=@@optimizer_switch;
696+
set use_stat_tables=@save_use_stat_tables;
697+
#
628698
# MDEV-18899: Server crashes in Field::set_warning_truncated_wrong_value
629699
#
630700
set names utf8;

mysql-test/r/stat_tables_innodb.result

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,76 @@ MAX(pk)
652652
NULL
653653
DROP TABLE t1;
654654
#
655+
# MDEV-17605: SHOW INDEXES with use_stat_tables='preferably'
656+
#
657+
set use_stat_tables='preferably';
658+
CREATE DATABASE dbt3_s001;
659+
use dbt3_s001;
660+
set @save_optimizer_switch=@@optimizer_switch;
661+
set optimizer_switch='extended_keys=off';
662+
select * from mysql.table_stats;
663+
db_name table_name cardinality
664+
dbt3_s001 lineitem 6005
665+
select * from mysql.index_stats;
666+
db_name table_name index_name prefix_arity avg_frequency
667+
dbt3_s001 lineitem PRIMARY 1 4.0033
668+
dbt3_s001 lineitem PRIMARY 2 1.0000
669+
dbt3_s001 lineitem i_l_shipdate 1 2.6500
670+
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
671+
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
672+
dbt3_s001 lineitem i_l_partkey 1 30.0250
673+
dbt3_s001 lineitem i_l_suppkey 1 600.5000
674+
dbt3_s001 lineitem i_l_receiptdate 1 2.6477
675+
dbt3_s001 lineitem i_l_orderkey 1 4.0033
676+
dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033
677+
dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404
678+
dbt3_s001 lineitem i_l_commitdate 1 2.7160
679+
SHOW INDEXES FROM lineitem;
680+
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
681+
lineitem 0 PRIMARY 1 l_orderkey A 1500 NULL NULL BTREE
682+
lineitem 0 PRIMARY 2 l_linenumber A 6005 NULL NULL BTREE
683+
lineitem 1 i_l_shipdate 1 l_shipDATE A 2266 NULL NULL YES BTREE
684+
lineitem 1 i_l_suppkey_partkey 1 l_partkey A 200 NULL NULL YES BTREE
685+
lineitem 1 i_l_suppkey_partkey 2 l_suppkey A 699 NULL NULL YES BTREE
686+
lineitem 1 i_l_partkey 1 l_partkey A 200 NULL NULL YES BTREE
687+
lineitem 1 i_l_suppkey 1 l_suppkey A 10 NULL NULL YES BTREE
688+
lineitem 1 i_l_receiptdate 1 l_receiptDATE A 2268 NULL NULL YES BTREE
689+
lineitem 1 i_l_orderkey 1 l_orderkey A 1500 NULL NULL BTREE
690+
lineitem 1 i_l_orderkey_quantity 1 l_orderkey A 1500 NULL NULL BTREE
691+
lineitem 1 i_l_orderkey_quantity 2 l_quantity A 5771 NULL NULL YES BTREE
692+
lineitem 1 i_l_commitdate 1 l_commitDATE A 2210 NULL NULL YES BTREE
693+
SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name='lineitem';
694+
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
695+
def dbt3_s001 lineitem 0 dbt3_s001 PRIMARY 1 l_orderkey A 1500 NULL NULL BTREE
696+
def dbt3_s001 lineitem 0 dbt3_s001 PRIMARY 2 l_linenumber A 6005 NULL NULL BTREE
697+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_shipdate 1 l_shipDATE A 2266 NULL NULL YES BTREE
698+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_suppkey_partkey 1 l_partkey A 200 NULL NULL YES BTREE
699+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_suppkey_partkey 2 l_suppkey A 699 NULL NULL YES BTREE
700+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_partkey 1 l_partkey A 200 NULL NULL YES BTREE
701+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_suppkey 1 l_suppkey A 10 NULL NULL YES BTREE
702+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_receiptdate 1 l_receiptDATE A 2268 NULL NULL YES BTREE
703+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_orderkey 1 l_orderkey A 1500 NULL NULL BTREE
704+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_orderkey_quantity 1 l_orderkey A 1500 NULL NULL BTREE
705+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_orderkey_quantity 2 l_quantity A 5771 NULL NULL YES BTREE
706+
def dbt3_s001 lineitem 1 dbt3_s001 i_l_commitdate 1 l_commitDATE A 2210 NULL NULL YES BTREE
707+
SELECT
708+
COUNT(DISTINCT l_orderkey), COUNT(DISTINCT l_orderkey,l_linenumber),
709+
COUNT(DISTINCT l_shipDATE),
710+
COUNT(DISTINCT l_partkey), COUNT(DISTINCT l_partkey,l_suppkey),
711+
COUNT(DISTINCT l_suppkey), COUNT(DISTINCT l_receiptDATE),
712+
COUNT(DISTINCT l_orderkey, l_quantity), COUNT(DISTINCT l_commitDATE)
713+
FROM lineitem;
714+
COUNT(DISTINCT l_orderkey) COUNT(DISTINCT l_orderkey,l_linenumber) COUNT(DISTINCT l_shipDATE) COUNT(DISTINCT l_partkey) COUNT(DISTINCT l_partkey,l_suppkey) COUNT(DISTINCT l_suppkey) COUNT(DISTINCT l_receiptDATE) COUNT(DISTINCT l_orderkey, l_quantity) COUNT(DISTINCT l_commitDATE)
715+
1500 6005 2266 200 700 10 2268 5772 2211
716+
set optimizer_switch=@save_optimizer_switch;
717+
DROP DATABASE dbt3_s001;
718+
USE test;
719+
delete from mysql.table_stats;
720+
delete from mysql.column_stats;
721+
delete from mysql.index_stats;
722+
set @save_optimizer_switch=@@optimizer_switch;
723+
set use_stat_tables=@save_use_stat_tables;
724+
#
655725
# MDEV-18899: Server crashes in Field::set_warning_truncated_wrong_value
656726
#
657727
set names utf8;

mysql-test/r/type_date.result

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,5 +854,30 @@ d COUNT(*)
854854
NULL 2
855855
DROP TABLE t1;
856856
#
857+
# MDEV-17299 Assertion `maybe_null' failed in make_sortkey
858+
#
859+
CREATE TABLE t1 (pk int NOT NULL, d1 date, d2 date NOT NULL);
860+
INSERT INTO t1 values (1,'2018-06-22','2018-06-22'),(2,'2018-07-11','2018-07-11');
861+
CREATE VIEW v1 AS SELECT * FROM t1;
862+
SELECT group_concat(d1/(CASE 'b' WHEN 'j' THEN 'c' END))
863+
FROM v1 GROUP BY greatest(pk, 0, d2);
864+
group_concat(d1/(CASE 'b' WHEN 'j' THEN 'c' END))
865+
NULL
866+
Warnings:
867+
Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
868+
Warning 1292 Incorrect datetime value: '2' for column `test`.`t1`.`pk` at row 1
869+
Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
870+
Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
871+
Warning 1292 Incorrect datetime value: '2' for column `test`.`t1`.`pk` at row 2
872+
CREATE TABLE t2 AS SELECT greatest(pk, 0, d2) AS c1 FROM t1 LIMIT 0;
873+
SHOW CREATE TABLE t2;
874+
Table Create Table
875+
t2 CREATE TABLE `t2` (
876+
`c1` date DEFAULT NULL
877+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
878+
DROP TABLE t2;
879+
DROP VIEW v1;
880+
DROP TABLE t1;
881+
#
857882
# End of 10.1 tests
858883
#

mysql-test/r/update_innodb.result

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,27 @@ SELECT * FROM t1;
6565
a_id b_id c_id
6666
1 NULL NULL
6767
drop table t1,t2;
68+
#
69+
# MDEV-18300: ASAN error in Field_blob::get_key_image upon UPDATE with subquery
70+
#
71+
set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
72+
set @save_use_stat_tables= @@use_stat_tables;
73+
set use_stat_tables=preferably;
74+
set optimizer_use_condition_selectivity=4;
75+
CREATE TABLE t1 (a INT, b CHAR(8)) ENGINE=InnoDB;
76+
insert into t1 values (1,'foo'),(2, 'abc');
77+
CREATE TABLE t2 (c CHAR(8), d BLOB) ENGINE=InnoDB;
78+
insert into t2 values ('abc', 'foo'),('edf', 'food');
79+
ANALYZE TABLE t1,t2;
80+
UPDATE t1 SET a = 1 WHERE b = ( SELECT c FROM t2 WHERE d = 'foo' );
81+
SELECT * FROM t1;
82+
a b
83+
1 foo
84+
1 abc
85+
DROP TABLE t1, t2;
86+
create table t1 (a int not null, b int, c int) engine=InnoDB;
87+
create table t2 (d int, e int) engine=InnoDB;
88+
update t1, t2 set a=NULL, b=2, c=NULL where b=d and e=200;
89+
drop table t1,t2;
90+
set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
91+
set @@use_stat_tables= @save_use_stat_tables;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
drop table if exists t1;
2+
#
3+
# MDEV-17297: stats.records=0 for a table of Archive engine when it has rows, when we run ANALYZE command
4+
#
5+
CREATE TABLE t1 (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT)engine=archive;
6+
INSERT INTO t1 VALUES
7+
(101, PointFromText('POINT(10 10)')),
8+
(102, PointFromText('POINT(20 10)')),
9+
(103, PointFromText('POINT(20 20)')),
10+
(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
11+
set @tmp1= @@optimizer_use_condition_selectivity;
12+
set @tmp2= @@use_stat_tables;
13+
set optimizer_use_condition_selectivity=4;
14+
set use_stat_tables=PREFERABLY;
15+
ANALYZE TABLE t1;
16+
Table Op Msg_type Msg_text
17+
test.t1 analyze status Engine-independent statistics collected
18+
test.t1 analyze note The storage engine for the table doesn't support analyze
19+
select * from mysql.table_stats where table_name='t1' and db_name=database();
20+
db_name table_name cardinality
21+
test t1 4
22+
drop table t1;
23+
set optimizer_use_condition_selectivity=@tmp1;
24+
set use_stat_tables=@tmp2;

0 commit comments

Comments
 (0)