List:General Discussion« Previous MessageNext Message »
From:Malko Malko Date:October 2 2001 3:22pm
Subject: Hazardous problem making arithmetic operation on date fields.
View as plain text  
>Description:
        When multiplying a date field with a number( any type ) field for 
some values in any of these 2 fields mysql did nt answer to queries.
>How-To-Repeat:
#
# Table structure for table 'testdate'
#

CREATE TABLE testdate (
   ID int(11) NOT NULL auto_increment,
   DATE time DEFAULT '00:00:00' NOT NULL,
   coef decimal(4,2) DEFAULT '0.00' NOT NULL,
   PRIMARY KEY (ID)
);

#
# Dumping data for table 'testdate'
#

INSERT INTO testdate VALUES( '1', '15:54:52', '0.75');
INSERT INTO testdate VALUES( '2', '00:17:21', '0.75');
INSERT INTO testdate VALUES( '3', '00:10:00', '0.75');

when executing this query :
mysql> select date,coef,sec_to_time(time_to_sec(date*coef)) from testdate;
+----------+------+-------------------------------------+
| date     | coef | sec_to_time(time_to_sec(date*coef)) |
+----------+------+-------------------------------------+
| 15:54:52 | 0.75 | NULL                                |
| 00:17:21 | 0.75 | NULL                                |
| 00:10:00 | 0.75 | 00:07:50                            |
+----------+------+-------------------------------------+
3 rows in set (0.00 sec)


>Fix:
        <how to correct or work around the problem, if known (multiple 
lines)>

>Submitter-Id:  <submitter ID>
>Originator:    Malko (malkoo@stripped)
>Organization:
<organization of PR author (multiple lines)>
>MySQL support: [none | licence | email support | extended email support ]
>Synopsis:
>Severity:       non-critical
>Priority: medium
>Category:      mysql
>Class:          sw-bug
>Release:       mysql-3.23.31 (Official MySQL RPM)
>Server: /usr/bin/mysqladmin  Ver 8.13 Distrib 3.23.31, for pc-linux-gnu on 
>i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version          3.23.31
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/lib/mysql/mysql.sock
Uptime:                 20 days 4 hours 17 min 53 sec

Threads: 1  Questions: 96455  Slow queries: 0  Opens: 30  Flush tables: 1  
Open tables: 10 Queries per second avg: 0.055
>Environment:
        <machine, os, target, libraries (multiple lines)>
System: Linux Trex 2.2.18 #2 SMP Thu Feb 8 14:10:31 CET 2001 i686 unknown
Architecture: i686

Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc 
/usr/bin/cc
GCC: Reading specs from 
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
Compilation info: CC='egcs'  CFLAGS='-O6 -fomit-frame-pointer -mpentium'  
CXX='egcs'  CXXFLAGS='-O6 -fomit-frame-pointer                  
-felide-constructors -fno-exceptions -fno-rtti -mpentium'  LDFLAGS=''
LIBC:
lrwxrwxrwx    1 root     root           13 Jan 18  2001 /lib/libc.so.6 -> 
libc-2.1.3.so
-rwxr-xr-x    1 root     root      4101324 Feb 29  2000 /lib/libc-2.1.3.so
-rw-r--r--    1 root     root     20272704 Feb 29  2000 /usr/lib/libc.a
-rw-r--r--    1 root     root          178 Feb 29  2000 /usr/lib/libc.so
Configure command: ./configure  --disable-shared 
--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static 
--enable-assembler --with-mysqld-user=mysql 
--with-unix-socket-path=/var/lib/mysql/mysql.sock --prefix=/ 
--with-extra-charsets=complex --exec-prefix=/usr --libexecdir=/usr/sbin 
--sysconfdir=/etc --datadir=/usr/share --localstatedir=/var/lib/mysql 
--infodir=/usr/info --includedir=/usr/include --mandir=/usr/man 
--without-berkeley-db '--with-comment=Official MySQL RPM'
Perl: This is perl, version 5.005_03 built for i386-linux


_________________________________________________________________
Téléchargez MSN Explorer gratuitement à l'adresse 
http://explorer.msn.fr/intl.asp

Thread
Hazardous problem making arithmetic operation on date fields.Malko Malko2 Oct
  • Re: Hazardous problem making arithmetic operation on date fields.Carl Troein2 Oct
  • Re: Hazardous problem making arithmetic operation on date fields.Paul DuBois2 Oct