~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/os0proc.h

  • 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
 
/*****************************************************************************
2
 
 
3
 
Copyright (C) 1995, 2009, Innobase Oy. All Rights Reserved.
4
 
 
5
 
This program is free software; you can redistribute it and/or modify it under
6
 
the terms of the GNU General Public License as published by the Free Software
7
 
Foundation; version 2 of the License.
8
 
 
9
 
This program is distributed in the hope that it will be useful, but WITHOUT
10
 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
 
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
 
 
13
 
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/**************************************************//**
20
 
@file include/os0proc.h
21
 
The interface to the operating system
22
 
process control primitives
23
 
 
24
 
Created 9/30/1995 Heikki Tuuri
25
 
*******************************************************/
26
 
 
27
 
#ifndef os0proc_h
28
 
#define os0proc_h
29
 
 
30
 
#include "univ.i"
31
 
 
32
 
#ifdef UNIV_LINUX
33
 
#include <sys/ipc.h>
34
 
#include <sys/shm.h>
35
 
#endif
36
 
 
37
 
typedef void*                   os_process_t;
38
 
typedef unsigned long int       os_process_id_t;
39
 
 
40
 
extern ibool os_use_large_pages;
41
 
/* Large page size. This may be a boot-time option on some platforms */
42
 
extern ulint os_large_page_size;
43
 
 
44
 
/****************************************************************//**
45
 
Converts the current process id to a number. It is not guaranteed that the
46
 
number is unique. In Linux returns the 'process number' of the current
47
 
thread. That number is the same as one sees in 'top', for example. In Linux
48
 
the thread id is not the same as one sees in 'top'.
49
 
@return process id as a number */
50
 
UNIV_INTERN
51
 
ulint
52
 
os_proc_get_number(void);
53
 
/*====================*/
54
 
/****************************************************************//**
55
 
Allocates large pages memory.
56
 
@return allocated memory */
57
 
UNIV_INTERN
58
 
void*
59
 
os_mem_alloc_large(
60
 
/*===============*/
61
 
        ulint*  n);                     /*!< in/out: number of bytes */
62
 
/****************************************************************//**
63
 
Frees large pages memory. */
64
 
UNIV_INTERN
65
 
void
66
 
os_mem_free_large(
67
 
/*==============*/
68
 
        void    *ptr,                   /*!< in: pointer returned by
69
 
                                        os_mem_alloc_large() */
70
 
        ulint   size);                  /*!< in: size returned by
71
 
                                        os_mem_alloc_large() */
72
 
 
73
 
#ifndef UNIV_NONINL
74
 
#include "os0proc.ic"
75
 
#endif
76
 
 
77
 
#endif