Commit 668d09cc authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Fixed bug in DATE_FORMAT when used with GROUP BY

parent c1ab560c
......@@ -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);
......
......@@ -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
......@@ -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
......@@ -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;
......@@ -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 );
......
......@@ -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;
......
......@@ -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) {}
......
......@@ -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);
}
......
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