Fixed probelm with count(*) and normal functions when no matchin rows.

Changed 'lib' to 'master-data'
Fix for slow slaves
This commit is contained in:
monty@donna.mysql.fi 2001-04-21 17:12:59 +03:00
parent 0f37b1244b
commit 1e3df575b9
11 changed files with 48 additions and 10 deletions

View File

@ -43943,6 +43943,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.38
@itemize @bullet
@item
Fixed problems with function returning empty string when using
together with a group functions and a @code{WHERE} that didn't match any rows.
@item
New program @code{mysqlcheck}.
@item
Added database name to output for admin commands like @code{CHECK},

View File

@ -20,6 +20,14 @@
#ifndef _mysql_h
#define _mysql_h
#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */
#undef WIN
#undef _WIN
#undef _WIN32
#undef _WIN64
#undef __WIN__
#endif
#ifndef MYSQL_SERVER
#ifdef __cplusplus
extern "C" {

View File

@ -16,11 +16,11 @@
MA 02111-1307, USA */
#define DONT_USE_RAID
#include <global.h>
#if defined(__WIN__) || defined(_WIN32) || defined(_WIN64)
#include <winsock.h>
#include <odbcinst.h>
#endif
#include <global.h>
#include <my_sys.h>
#include <mysys_err.h>
#include <m_string.h>

View File

@ -30,7 +30,7 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/t/*.test $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(distdir)/t
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.001 $(distdir)/std_data
install-data-local:
$(mkinstalldirs) \

View File

@ -9,5 +9,7 @@ connection master;
reset master;
connection slave;
reset slave;
# Clean up old test tables
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start;
@r/slave-running.result show status like 'Slave_running';

View File

@ -25,8 +25,8 @@ then
data=var/slave-data
ldata=$fix_bin/var/slave-data
else
data=var/lib
ldata=$fix_bin/var/lib
data=var/master-data
ldata=$fix_bin/var/master-data
fi
mdata=$data/mysql

View File

@ -188,7 +188,7 @@ done
#--
MYRUN_DIR=$MYSQL_TEST_DIR/var/run
MASTER_MYDDIR="$MYSQL_TEST_DIR/var/lib"
MASTER_MYDDIR="$MYSQL_TEST_DIR/var/master-data"
MASTER_MYSOCK="$MYSQL_TMP_DIR/mysql-master.sock"
MASTER_MYPID="$MYRUN_DIR/mysqld.pid"
MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/mysqld.log"
@ -288,6 +288,8 @@ prompt_user ()
read unused
}
# We can't use diff -u as this isn't portable
show_failed_diff ()
{
reject_file=r/$1.reject
@ -296,7 +298,7 @@ show_failed_diff ()
then
echo "Below are the diffs between actual and expected results:"
echo "-------------------------------------------------------"
$DIFF -u $result_file $reject_file
$DIFF -c $result_file $reject_file
echo "-------------------------------------------------------"
echo "Please e-mail the above, along with the output of mysqlbug"
echo "and any other relevant info to bugs@lists.mysql.com"

View File

@ -30,3 +30,7 @@ Documentation 0
Host communication 0
kkkkkkkkkkk lllllllllll 3
Test Procedures 0
1+1 a count(*)
2 a 0
1+1 a count(*)
2 a 0

View File

@ -2,6 +2,7 @@
# Test of group (Failed for Lars Hoss <lh@pbm.de>)
#
drop table if exists t1,t2;
CREATE TABLE t1 (
spID int(10) unsigned,
userID int(10) unsigned,
@ -208,3 +209,14 @@ select value,description,bug_id from t2 left join t1 on t2.program=t1.product an
select value,description,COUNT(bug_id) from t2 left join t1 on t2.program=t1.product and t2.value=t1.component where program="AAAAA" group by value;
drop table t1,t2;
#
# Problem with functions and group functions when no matching rows
#
create table t1 (foo int);
insert into t1 values (1);
select 1+1, "a",count(*) from t1 where foo in (2);
insert into t1 values (1);
select 1+1,"a",count(*) from t1 where foo in (2);
drop table t1;

View File

@ -1,3 +1,3 @@
rm -f $MYSQL_TEST_DIR/var/lib/master-bin.*
cp $MYSQL_TEST_DIR/std_data/master-bin.001 $MYSQL_TEST_DIR/var/lib/
echo ./master-bin.001 > $MYSQL_TEST_DIR/var/lib/master-bin.index
rm -f $MYSQL_TEST_DIR/var/master-data/master-bin.*
cp $MYSQL_TEST_DIR/std_data/master-bin.001 $MYSQL_TEST_DIR/var/master-data/
echo ./master-bin.001 > $MYSQL_TEST_DIR/var/master-data/master-bin.index

View File

@ -4643,7 +4643,11 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
else
{
if (!join->first_record)
{
/* No matching rows for group function */
clear_tables(join);
copy_fields(&join->tmp_table_param);
}
if (join->having && join->having->val_int() == 0)
error= -1; // Didn't satisfy having
else
@ -4875,7 +4879,11 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if (idx < (int) join->send_group_parts)
{
if (!join->first_record)
{
/* No matching rows for group function */
clear_tables(join);
copy_fields(&join->tmp_table_param);
}
copy_sum_funcs(join->sum_funcs);
if (!join->having || join->having->val_int())
{
@ -4899,7 +4907,6 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
}
if (idx < (int) join->send_group_parts)
{
copy_fields(&join->tmp_table_param);
copy_funcs(join->tmp_table_param.funcs);
init_sum_functions(join->sum_funcs);
if (join->procedure)