diff options
author | unknown <monty@hundin.mysql.fi> | 2002-03-06 18:36:31 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-03-06 18:36:31 +0200 |
commit | d6998363afc004fd92248af521ed40fa52027954 (patch) | |
tree | b15e545bf81d86ec528ceb737592fa34e6024c18 | |
parent | 39cdb786fd7db97399fff788df7547f5be73b132 (diff) | |
download | mariadb-git-d6998363afc004fd92248af521ed40fa52027954.tar.gz |
Fixed bug in DATE_FORMAT when used with GROUP BY
Build-tools/Do-compile:
Fixed typo
Docs/manual.texi:
Changelog
mysql-test/r/type_date.result:
Added test of bug in DATE_FORMAT
mysql-test/t/type_date.test:
Added test of bug in DATE_FORMAT
scripts/mysqlhotcopy.sh:
Fix for RAID files
sql/table.cc:
Fixed typo in last patch
-rwxr-xr-x | Build-tools/Do-compile | 2 | ||||
-rw-r--r-- | Docs/manual.texi | 3 | ||||
-rw-r--r-- | mysql-test/r/type_date.result | 4 | ||||
-rw-r--r-- | mysql-test/t/type_date.test | 13 | ||||
-rw-r--r-- | scripts/mysqlhotcopy.sh | 4 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 2 | ||||
-rw-r--r-- | sql/item_timefunc.h | 1 | ||||
-rw-r--r-- | sql/table.cc | 2 |
8 files changed, 26 insertions, 5 deletions
diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 4fc0becab71..1e20cb35ed7 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -7,7 +7,7 @@ $opt_tmp=$opt_version_suffix=""; $opt_help=$opt_Information=$opt_delete=$opt_debug=$opt_stage=$opt_rsh_mail=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_no_mysqltest=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=0; $opt_innodb=$opt_bdb=0; -GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip","version-suffix=s", "with-other-libc=s) || usage(); +GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip","version-suffix=s", "with-other-libc=s") || usage(); usage() if ($opt_help || $opt_Information); usage() if (!$opt_distribution); diff --git a/Docs/manual.texi b/Docs/manual.texi index 413a9a8ce0c..48b5be95b41 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46898,6 +46898,9 @@ Fixed binary builds to use @code{--enable-local-infile}. Update source to work with new @code{bison} version. @item Updated shell scripts to new agree with new POSIX standard. +@item +Fixed bug where @code{DATE_FORMAT()} returned empty string when used +with @code{GROUP BY}. @end itemize @node News-3.23.49, News-3.23.48, News-3.23.50, News-3.23.x diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 9aa6d6fb9b7..df8f0ee1814 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -18,3 +18,7 @@ s date_add(date,INTERVAL 1 DAY) date_add(date,INTERVAL 1 SECOND) 2000-08-11 2000-08-10 00:00:01 2000-08-12 2000-08-11 00:00:01 +DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) +Wed, 06 March 2002 10:11:12 GMT-0800 +DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) +Wed, 06 March 2002 10:11:12 GMT-0800 Wed, 06 March 2002 10:11:12 GMT-0800 diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 0d2e18bcc94..68c2d55aac9 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -62,3 +62,16 @@ create table t1 (date date); insert into t1 values ("2000-08-10"),("2000-08-11"); select date_add(date,INTERVAL 1 DAY),date_add(date,INTERVAL 1 SECOND) from t1; drop table t1; + +# +# Test problem with DATE_FORMAT +# + +CREATE TABLE t1(AFIELD INT); +INSERT INTO t1 VALUES(1); +CREATE TABLE t2(GMT VARCHAR(32)); +INSERT INTO t2 VALUES('GMT-0800'); +SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1, t2 GROUP BY t1.AFIELD; +INSERT INTO t1 VALUES(1); +SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD; +drop table t1,t2; diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index caf2615fe7a..b0fee84c332 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -37,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome. # Documentation continued at end of file -my $VERSION = "1.14"; +my $VERSION = "1.15"; my $opt_tmpdir = $ENV{TMPDIR} || "/tmp"; @@ -562,7 +562,7 @@ sub copy_files { # add recursive option for scp push @cp, "-r" if $^O =~ /m^(solaris|linux|freebsd)$/ && $method =~ /^scp\b/; - my @non_raid = grep { $_ !~ m:\d\d/: } @$files; + my @non_raid = grep { ! m:/\d{2}/[^/]+$: } @$files; # add files to copy and the destination directory safe_system( @cp, @non_raid, $target ); diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index b198900d24e..eb9b1423c78 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -672,7 +672,7 @@ String *Item_func_date_format::val_str(String *str) else size=format_length(format); if (format == str) - str=&str_value; // Save result here + str=&value; // Save result here if (str->alloc(size)) { null_value=1; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 1343cdad390..6913d4c6809 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -297,6 +297,7 @@ class Item_func_date_format :public Item_str_func { int fixed_length; const bool date_or_time; + String value; public: Item_func_date_format(Item *a,Item *b,bool date_or_time_arg) :Item_str_func(a,b),date_or_time(date_or_time_arg) {} diff --git a/sql/table.cc b/sql/table.cc index 7510e6bcce8..247e1dda196 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -601,7 +601,7 @@ int closefrm(register TABLE *table) } delete table->file; table->file=0; /* For easyer errorchecking */ - hash_free(&outparam->name_hash); + hash_free(&table->name_hash); free_root(&table->mem_root,MYF(0)); DBUG_RETURN(error); } |