~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/lib/dtr_gcov.pl

  • Committer: Stewart Smith
  • Date: 2010-08-12 16:48:46 UTC
  • mto: This revision was merged to the branch mainline in revision 1707.
  • Revision ID: stewart@flamingspork.com-20100812164846-s9bhy47g60bvqs41
bug lp:611379 Equivalent queries with Impossible where return different results

The following two equivalent queries return different results in maria 5.2 and 5.3 (and identical results in mysql 5.5.5) :

SELECT SUM( DISTINCT table1 .`pk` ) FROM B table1 STRAIGHT_JOIN ( BB table2 JOIN CC ON table2 .`col_varchar_key` ) ON table2 .`pk` ;

SELECT * FROM ( SELECT SUM( DISTINCT table1 .`pk` ) FROM B table1 STRAIGHT_JOIN ( BB table2 JOIN CC ON table2 .`col_varchar_key` ) ON table2 .`pk` );

MariaDB returns 0 on the second query and NULL on the first, whereas MySQL returns NULL on both. In MariaDB, both EXPLAIN plans agree that "Impossible WHERE noticed after reading const tables"



We have some slightly different output in drizzle:

main.bug_lp611379 [ fail ]
drizzletest: At line 9: query 'explain select * from (select sum(distinct t1.a) from t1,t2 where t1.a=t2.a)
as t' failed: 1048: Column 'sum(distinct t1.a)' cannot be null

but the fix gets us the correct query results, although with slightly different execution plans.



This fix is directly ported from MariaDB.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- cperl -*-
2
 
# Copyright (C) 2004, 2006 MySQL AB
3
 
4
 
# This program is free software; you can redistribute it and/or modify
5
 
# it under the terms of the GNU General Public License as published by
6
 
# the Free Software Foundation; version 2 of the License.
7
 
8
 
# This program is distributed in the hope that it will be useful,
9
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
# GNU General Public License for more details.
12
 
13
 
# You should have received a copy of the GNU General Public License
14
 
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16
 
 
17
 
# This is a library file used by the Perl version of drizzle-test-run,
18
 
# and is part of the translation of the Bourne shell script with the
19
 
# same name.
20
 
 
21
 
use strict;
22
 
 
23
 
# These are not to be prefixed with "dtr_"
24
 
 
25
 
sub gcov_prepare ();
26
 
sub gcov_collect ();
27
 
 
28
 
##############################################################################
29
 
#
30
 
#  
31
 
#
32
 
##############################################################################
33
 
 
34
 
sub gcov_prepare () {
35
 
 
36
 
  `find $::glob_basedir -name \*.gcov \
37
 
    -or -name \*.da | xargs rm`;
38
 
}
39
 
 
40
 
# Used by gcov
41
 
our @drizzled_src_dirs=
42
 
  (
43
 
   "strings",
44
 
   "mysys",
45
 
   "include",
46
 
   "extra",
47
 
   "regex",
48
 
   "isam",
49
 
   "merge",
50
 
   "myisam",
51
 
   "myisammrg",
52
 
   "MEMORY",
53
 
   "sql",
54
 
  );
55
 
 
56
 
sub gcov_collect () {
57
 
 
58
 
  print "Collecting source coverage info...\n";
59
 
  -f $::opt_gcov_msg and unlink($::opt_gcov_msg);
60
 
  -f $::opt_gcov_err and unlink($::opt_gcov_err);
61
 
  foreach my $d ( @drizzled_src_dirs )
62
 
  {
63
 
    chdir("$::glob_basedir/$d");
64
 
    foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) )
65
 
    {
66
 
      `$::opt_gcov $f 2>>$::opt_gcov_err  >>$::opt_gcov_msg`;
67
 
    }
68
 
    chdir($::glob_drizzle_test_dir);
69
 
  }
70
 
  print "gcov info in $::opt_gcov_msg, errors in $::opt_gcov_err\n";
71
 
}
72
 
 
73
 
 
74
 
1;