List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 29 1999 8:12pm
Subject:3.23 year() used with timestamp -bug
View as plain text  
>>>>> "Balint" == Balint TOTH <bali@stripped> writes:

Balint> Hi All!
Balint> Just try this:

Balint> use test;
Balint> create table tstest (a timestamp);
Balint> insert into tstest values (now());
Balint> select date_format(a,"%Y %y"),year(a),year(now()) from tstest;
Balint> drop table tstest;

Balint> select output:
Balint> 0099,99,1999

Balint> Do you guys know about this one? If you change the field type to
Balint> datetime, it works fine.

Balint> 3.23.2-4 do have this bug, i don't know anything about earlier versions.

Hi!

Yes, this is a bug in the new faster time handling in 3.23 for timestamps

Fix:

*** /my/monty/master/mysql-3.23.4-alpha/sql/field.cc	Thu Sep 23 01:53:58 1999
--- ./field.cc	Wed Sep 29 23:10:07 1999
***************
*** 2338,2344 ****
      time_t time_arg= (time_t) temp;
      localtime_r(&time_arg,&tm_tmp);
      struct tm *start= &tm_tmp;
!     ltime->year=	start->tm_year;
      ltime->month=	start->tm_mon+1;
      ltime->day=		start->tm_mday;
      ltime->hour=	start->tm_hour;
--- 2339,2345 ----
      time_t time_arg= (time_t) temp;
      localtime_r(&time_arg,&tm_tmp);
      struct tm *start= &tm_tmp;
!     ltime->year=	start->tm_year+1900;
      ltime->month=	start->tm_mon+1;
      ltime->day=		start->tm_mday;
      ltime->hour=	start->tm_hour;

Regards,
Monty
Thread
3.23 year() used with timestamp -bugBalint TOTH29 Sep
  • Re: 3.23 year() used with timestamp -bugBob Kline29 Sep
    • Re: 3.23 year() used with timestamp -bugPaul DuBois29 Sep
  • 3.23 year() used with timestamp -bugMichael Widenius29 Sep
    • More tm_year, Was: 3.23 year() used with timestamp -bugPeter Strömberg30 Sep
      • More tm_year, Was: 3.23 year() used with timestamp -bugMichael Widenius30 Sep