@@ -580,3 +580,186 @@ ANALYZE
580
580
}
581
581
}
582
582
drop table t0, t1, t2;
583
+ #
584
+ # MDEV-7267: Server crashes in Item_field::print on ANALYZE FORMAT=JSON
585
+ #
586
+ CREATE TABLE t1 (a INT);
587
+ INSERT INTO t1 VALUES (1),(2);
588
+ CREATE TABLE t2 (b INT);
589
+ INSERT INTO t2 VALUES (3),(4);
590
+ ANALYZE FORMAT=JSON SELECT STRAIGHT_JOIN * FROM t1, t2 WHERE b IN ( SELECT a FROM t1 );
591
+ ANALYZE
592
+ {
593
+ "query_block": {
594
+ "select_id": 1,
595
+ "r_loops": 1,
596
+ "volatile parameter": "REPLACED",
597
+ "table": {
598
+ "table_name": "t1",
599
+ "access_type": "ALL",
600
+ "r_loops": 1,
601
+ "rows": 2,
602
+ "r_rows": 2,
603
+ "volatile parameter": "REPLACED",
604
+ "filtered": 100,
605
+ "r_filtered": 100
606
+ },
607
+ "block-nl-join": {
608
+ "table": {
609
+ "table_name": "<subquery2>",
610
+ "access_type": "ALL",
611
+ "possible_keys": ["distinct_key"],
612
+ "r_loops": 1,
613
+ "rows": 2,
614
+ "r_rows": 2,
615
+ "volatile parameter": "REPLACED",
616
+ "filtered": 100,
617
+ "r_filtered": 100
618
+ },
619
+ "buffer_type": "flat",
620
+ "buffer_size": "256Kb",
621
+ "join_type": "BNL",
622
+ "r_filtered": 100,
623
+ "materialized": {
624
+ "unique": 1,
625
+ "query_block": {
626
+ "select_id": 2,
627
+ "r_loops": 1,
628
+ "volatile parameter": "REPLACED",
629
+ "table": {
630
+ "table_name": "t1",
631
+ "access_type": "ALL",
632
+ "r_loops": 1,
633
+ "rows": 2,
634
+ "r_rows": 2,
635
+ "volatile parameter": "REPLACED",
636
+ "filtered": 100,
637
+ "r_filtered": 100
638
+ }
639
+ }
640
+ }
641
+ },
642
+ "block-nl-join": {
643
+ "table": {
644
+ "table_name": "t2",
645
+ "access_type": "ALL",
646
+ "r_loops": 1,
647
+ "rows": 2,
648
+ "r_rows": 2,
649
+ "volatile parameter": "REPLACED",
650
+ "filtered": 100,
651
+ "r_filtered": 100
652
+ },
653
+ "buffer_type": "incremental",
654
+ "buffer_size": "256Kb",
655
+ "join_type": "BNL",
656
+ "attached_condition": "(t2.b = `<subquery2>`.a)",
657
+ "r_filtered": 0
658
+ }
659
+ }
660
+ }
661
+ drop table t1,t2;
662
+ #
663
+ # MDEV-8864: Server crash #2 in Item_field::print on ANALYZE FORMAT=JSON
664
+ #
665
+ CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
666
+ INSERT INTO t1 VALUES (1),(2);
667
+ CREATE TABLE t2 (f2 INT) ENGINE=MyISAM;
668
+ INSERT INTO t2 VALUES (2),(3);
669
+ CREATE TABLE t3 (f3 INT) ENGINE=MyISAM;
670
+ INSERT INTO t3 VALUES (3),(4);
671
+ ANALYZE FORMAT=JSON
672
+ SELECT GROUP_CONCAT(f3) AS gc, ( SELECT MAX(f1) FROM t1, t2 WHERE f2 = f3 ) sq
673
+ FROM t2, t3
674
+ WHERE f3 IN ( 1, 2 )
675
+ GROUP BY sq ORDER BY gc;
676
+ ANALYZE
677
+ {
678
+ "query_block": {
679
+ "select_id": 1,
680
+ "r_loops": 1,
681
+ "volatile parameter": "REPLACED",
682
+ "filesort": {
683
+ "r_loops": 1,
684
+ "volatile parameter": "REPLACED",
685
+ "r_used_priority_queue": false,
686
+ "r_output_rows": 0,
687
+ "volatile parameter": "REPLACED",
688
+ "filesort": {
689
+ "r_loops": 1,
690
+ "volatile parameter": "REPLACED",
691
+ "r_used_priority_queue": false,
692
+ "r_output_rows": 0,
693
+ "volatile parameter": "REPLACED",
694
+ "temporary_table": {
695
+ "temporary_table": {
696
+ "table": {
697
+ "table_name": "t2",
698
+ "access_type": "ALL",
699
+ "r_loops": 1,
700
+ "rows": 2,
701
+ "r_rows": 2,
702
+ "volatile parameter": "REPLACED",
703
+ "filtered": 100,
704
+ "r_filtered": 100
705
+ },
706
+ "block-nl-join": {
707
+ "table": {
708
+ "table_name": "t3",
709
+ "access_type": "ALL",
710
+ "r_loops": 1,
711
+ "rows": 2,
712
+ "r_rows": 2,
713
+ "volatile parameter": "REPLACED",
714
+ "filtered": 100,
715
+ "r_filtered": 0,
716
+ "attached_condition": "(t3.f3 in (1,2))"
717
+ },
718
+ "buffer_type": "flat",
719
+ "buffer_size": "256Kb",
720
+ "join_type": "BNL",
721
+ "r_filtered": null
722
+ },
723
+ "subqueries": [
724
+ {
725
+ "expression_cache": {
726
+ "state": "uninitialized",
727
+ "r_loops": 0,
728
+ "query_block": {
729
+ "select_id": 2,
730
+ "table": {
731
+ "table_name": "t1",
732
+ "access_type": "ALL",
733
+ "r_loops": 0,
734
+ "rows": 2,
735
+ "r_rows": null,
736
+ "filtered": 100,
737
+ "r_filtered": null
738
+ },
739
+ "block-nl-join": {
740
+ "table": {
741
+ "table_name": "t2",
742
+ "access_type": "ALL",
743
+ "r_loops": 0,
744
+ "rows": 2,
745
+ "r_rows": null,
746
+ "filtered": 100,
747
+ "r_filtered": null
748
+ },
749
+ "buffer_type": "flat",
750
+ "buffer_size": "256Kb",
751
+ "join_type": "BNL",
752
+ "attached_condition": "(t2.f2 = t3.f3)",
753
+ "r_filtered": null
754
+ }
755
+ }
756
+ }
757
+ }
758
+ ]
759
+ }
760
+ }
761
+ }
762
+ }
763
+ }
764
+ }
765
+ drop table t1,t2,t3;
0 commit comments