TIMESTAMP columns allow values up to 61 for seconds
Bug #597778 reported by
Patrick Crews
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Drizzle |
Fix Released
|
Medium
|
Andrew Hutchings | ||
7.0 |
Fix Released
|
Medium
|
Andrew Hutchings |
Bug Description
TIMESTAMP columns can take values with seconds up to 61 (will fail if > 61).
The value is converted:
INSERT INTO t1 (b) VALUES('2000-01-01 12:00:61'); -> insert_value: "2000-01-01 12:01:01"
Test case:
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b TIMESTAMP);
# This INSERT should fail with ERROR 1685 (bad UNIX TIMESTAMP)
INSERT INTO t1 (b) VALUES('2000-01-01 12:00:61');
SELECT * FROM t1;
DROP TABLE t1;
Related branches
lp:~linuxjedi/drizzle/drizzle-bug-597778
- Drizzle Merge Team: Pending requested
-
Diff: 13 lines (+2/-1)1 file modifieddrizzled/temporal.cc (+2/-1)
Changed in drizzle: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in drizzle: | |
status: | Confirmed → In Progress |
To post a comment you must log in.
In drizzled/ temporal. cc:1357
1357 bool DateTime: :is_valid( ) const MIN_YEARS_ SQL && _years <= DRIZZLE_ MAX_YEARS_ SQL) gregorian_ year_month( _years, _months))
1358 {
1359 return (_years >= DRIZZLE_
1360 && (_months >= 1 && _months <= 12)
1361 && (_days >= 1 && _days <= days_in_
1362 && (_hours <= 23)
1363 && (_minutes <= 59)
1364 && (_seconds <= 61); /* Leap second... */
1365 }
it seems it's legal to be 61 seconds in case there is a leap second. any background on this?
backtrace:
(gdb) bt :DateTime: :is_valid (this=0x6400000000) at drizzled/ temporal. cc:1357 :Timestamp: :is_valid (this=0x7f15d42 579b0) temporal. cc:1370 :DateTime: :from_string (this=0x7f15d42 579b0, temporal. cc:161 :Field_ timestamp: :store (this=0x3acd558, field/timestamp .cc:167 :Item:: save_str_ value_in_ field (this=0x3ac47d8, 0x3acd558, result=0x3ac47e8) at drizzled/ item.cc: 261 :Item_string: :save_in_ field (this=0x3ac47d8, 0x3acd558) at drizzled/ item/string. cc:174 :fill_record (session=0x3abf1e0, fields=@0x3ac01a8, @0x3ac4710, ignore_ errors= false) at drizzled/ sql_base. cc:4378 :mysql_ insert (session=0x3abf1e0, list=0x3ac43e8, fields=@0x3ac01a8, values_ list=@0x3ac01f0 , fields= @0x3ac01d8, update_ values= @0x3ac01c0, duplic= drizzled: :DUP_ERROR, sql_insert. cc:358 :statement: :Insert: :execute (this=0x3ac7b00) statement/ insert. cc:57 command (session=0x3abf1e0) sql_parse. cc:478 :mysql_ parse (session=0x3abf1e0, sql_parse. cc:736 :dispatch_ command (command= drizzled: :COM_QUERY, 0x3abf1e0, 0x3abb1d1 "insert into t1 (a, b) values (4, '2000-01-01 12:00:61')", length= 55) at drizzled/ sql_parse. cc:223 :Session: :executeStateme nt (this=0x3abf1e0) session. cc:646 :Session: :run (this=0x3abf1e0) session. cc:505 duler:: runSession (this=0x32a0960, 0x3abf1e0) at ./plugin/ multi_thread/ multi_thread. h:67 multi_thread/ multi_thread. cc:43 libpthread. so.0
#0 drizzled:
#1 0x0000000000840d5b in drizzled:
at drizzled/
#2 0x0000000000843186 in drizzled:
from=0x3ac47c0 "2000-01-01 12:00:61", from_len=19) at drizzled/
#3 0x00000000005dc964 in drizzled:
from=0x3ac47c0 "2000-01-01 12:00:61", len=19) at drizzled/
#4 0x0000000000628bd2 in drizzled:
field=
#5 0x000000000066296a in drizzled:
field=
#6 0x000000000071b0ba in drizzled:
values=
#7 0x000000000072c0db in drizzled:
table_
update_
ignore=false) at drizzled/
#8 0x0000000000789c3c in drizzled:
at drizzled/
#9 0x000000000073ad69 in mysql_execute_
at drizzled/
#10 0x000000000073ae7d in drizzled:
inBuf=0x3ac9a38 "insert into t1 (a, b) values (4, '2000-01-01 12:00:61')", length=55)
at drizzled/
#11 0x000000000073b346 in drizzled:
session=
packet=
---Type <return> to continue, or q <return> to quit---
packet_
#12 0x0000000000705d38 in drizzled:
at drizzled/
#13 0x0000000000706484 in drizzled:
at drizzled/
#14 0x00007f15e7b97b50 in MultiThreadSche
session=
#15 0x00007f15e7b95fa2 in session_thread (arg=0x3abf1e0)
at plugin/
#16 0x00000033d84073da in start_thread () from /lib64/
#17 0x00000033d78e62bd in clone () from /lib64/libc.so.6