Commit fa6c9774 authored by unknown's avatar unknown

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

Changed 'lib' to 'master-data'
Fix for slow slaves


Docs/manual.texi:
  Changelog
include/mysql.h:
  Fixes for Cygwin
libmysql/libmysql.c:
  Fixes for Cygwin
mysql-test/Makefile.am:
  Include missing test files
mysql-test/include/master-slave.inc:
  Fixes for slow slaves
mysql-test/install_test_db.sh:
  Change 'lib' to 'master-data'
mysql-test/mysql-test-run.sh:
  Change 'lib' to 'master-data'
mysql-test/r/group_by.result:
  Test case for count(*) problem
mysql-test/t/group_by.test:
  Test case for count(*) problem
mysql-test/t/rpl000018-master.sh:
  Change 'lib' to 'master-data'
sql/sql_select.cc:
  Fix for count(*) problem
parent ab661dec
...@@ -43943,6 +43943,9 @@ not yet 100% confident in this code. ...@@ -43943,6 +43943,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.38 @appendixsubsec Changes in release 3.23.38
@itemize @bullet @itemize @bullet
@item @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}. New program @code{mysqlcheck}.
@item @item
Added database name to output for admin commands like @code{CHECK}, Added database name to output for admin commands like @code{CHECK},
...@@ -20,6 +20,14 @@ ...@@ -20,6 +20,14 @@
#ifndef _mysql_h #ifndef _mysql_h
#define _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 #ifndef MYSQL_SERVER
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
......
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
MA 02111-1307, USA */ MA 02111-1307, USA */
#define DONT_USE_RAID #define DONT_USE_RAID
#include <global.h>
#if defined(__WIN__) || defined(_WIN32) || defined(_WIN64) #if defined(__WIN__) || defined(_WIN32) || defined(_WIN64)
#include <winsock.h> #include <winsock.h>
#include <odbcinst.h> #include <odbcinst.h>
#endif #endif
#include <global.h>
#include <my_sys.h> #include <my_sys.h>
#include <mysys_err.h> #include <mysys_err.h>
#include <m_string.h> #include <m_string.h>
......
...@@ -30,7 +30,7 @@ dist-hook: ...@@ -30,7 +30,7 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/t/*.test $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(distdir)/t $(INSTALL_DATA) $(srcdir)/t/*.test $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(distdir)/t
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include $(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r $(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: install-data-local:
$(mkinstalldirs) \ $(mkinstalldirs) \
......
...@@ -9,5 +9,7 @@ connection master; ...@@ -9,5 +9,7 @@ connection master;
reset master; reset master;
connection slave; connection slave;
reset slave; reset slave;
# Clean up old test tables
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; slave start;
@r/slave-running.result show status like 'Slave_running'; @r/slave-running.result show status like 'Slave_running';
...@@ -25,8 +25,8 @@ then ...@@ -25,8 +25,8 @@ then
data=var/slave-data data=var/slave-data
ldata=$fix_bin/var/slave-data ldata=$fix_bin/var/slave-data
else else
data=var/lib data=var/master-data
ldata=$fix_bin/var/lib ldata=$fix_bin/var/master-data
fi fi
mdata=$data/mysql mdata=$data/mysql
......
...@@ -188,7 +188,7 @@ done ...@@ -188,7 +188,7 @@ done
#-- #--
MYRUN_DIR=$MYSQL_TEST_DIR/var/run 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_MYSOCK="$MYSQL_TMP_DIR/mysql-master.sock"
MASTER_MYPID="$MYRUN_DIR/mysqld.pid" MASTER_MYPID="$MYRUN_DIR/mysqld.pid"
MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/mysqld.log" MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/mysqld.log"
...@@ -288,6 +288,8 @@ prompt_user () ...@@ -288,6 +288,8 @@ prompt_user ()
read unused read unused
} }
# We can't use diff -u as this isn't portable
show_failed_diff () show_failed_diff ()
{ {
reject_file=r/$1.reject reject_file=r/$1.reject
...@@ -296,7 +298,7 @@ show_failed_diff () ...@@ -296,7 +298,7 @@ show_failed_diff ()
then then
echo "Below are the diffs between actual and expected results:" echo "Below are the diffs between actual and expected results:"
echo "-------------------------------------------------------" echo "-------------------------------------------------------"
$DIFF -u $result_file $reject_file $DIFF -c $result_file $reject_file
echo "-------------------------------------------------------" echo "-------------------------------------------------------"
echo "Please e-mail the above, along with the output of mysqlbug" echo "Please e-mail the above, along with the output of mysqlbug"
echo "and any other relevant info to bugs@lists.mysql.com" echo "and any other relevant info to bugs@lists.mysql.com"
......
...@@ -30,3 +30,7 @@ Documentation 0 ...@@ -30,3 +30,7 @@ Documentation 0
Host communication 0 Host communication 0
kkkkkkkkkkk lllllllllll 3 kkkkkkkkkkk lllllllllll 3
Test Procedures 0 Test Procedures 0
1+1 a count(*)
2 a 0
1+1 a count(*)
2 a 0
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Test of group (Failed for Lars Hoss <lh@pbm.de>) # Test of group (Failed for Lars Hoss <lh@pbm.de>)
# #
drop table if exists t1,t2;
CREATE TABLE t1 ( CREATE TABLE t1 (
spID int(10) unsigned, spID int(10) unsigned,
userID 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 ...@@ -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; 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; 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;
rm -f $MYSQL_TEST_DIR/var/lib/master-bin.* rm -f $MYSQL_TEST_DIR/var/master-data/master-bin.*
cp $MYSQL_TEST_DIR/std_data/master-bin.001 $MYSQL_TEST_DIR/var/lib/ cp $MYSQL_TEST_DIR/std_data/master-bin.001 $MYSQL_TEST_DIR/var/master-data/
echo ./master-bin.001 > $MYSQL_TEST_DIR/var/lib/master-bin.index echo ./master-bin.001 > $MYSQL_TEST_DIR/var/master-data/master-bin.index
...@@ -4643,7 +4643,11 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), ...@@ -4643,7 +4643,11 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
else else
{ {
if (!join->first_record) if (!join->first_record)
{
/* No matching rows for group function */
clear_tables(join); clear_tables(join);
copy_fields(&join->tmp_table_param);
}
if (join->having && join->having->val_int() == 0) if (join->having && join->having->val_int() == 0)
error= -1; // Didn't satisfy having error= -1; // Didn't satisfy having
else else
...@@ -4875,7 +4879,11 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), ...@@ -4875,7 +4879,11 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if (idx < (int) join->send_group_parts) if (idx < (int) join->send_group_parts)
{ {
if (!join->first_record) if (!join->first_record)
{
/* No matching rows for group function */
clear_tables(join); clear_tables(join);
copy_fields(&join->tmp_table_param);
}
copy_sum_funcs(join->sum_funcs); copy_sum_funcs(join->sum_funcs);
if (!join->having || join->having->val_int()) if (!join->having || join->having->val_int())
{ {
...@@ -4899,7 +4907,6 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), ...@@ -4899,7 +4907,6 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
} }
if (idx < (int) join->send_group_parts) if (idx < (int) join->send_group_parts)
{ {
copy_fields(&join->tmp_table_param);
copy_funcs(join->tmp_table_param.funcs); copy_funcs(join->tmp_table_param.funcs);
init_sum_functions(join->sum_funcs); init_sum_functions(join->sum_funcs);
if (join->procedure) if (join->procedure)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment