drizzle date and time functions corrupt blob data in pbxt engine
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Drizzle |
Fix Released
|
High
|
David Shrewsbury | ||
7.0 |
Fix Released
|
High
|
David Shrewsbury | ||
Cherry |
Won't Fix
|
High
|
Unassigned | ||
Dexter |
Won't Fix
|
High
|
Unassigned |
Bug Description
The log is a bit long, so I will describe with sql and comments...
CREATE TABLE t1 (
int_fld INT NOT NULL
, date_fld DATE NOT NULL
, datetime_fld DATETIME NOT NULL
, timestamp_fld TIMESTAMP NOT NULL
, char_fld CHAR(22) NOT NULL
, varchar_fld VARCHAR(22) NOT NULL
, text_fld TEXT NOT NULL
, blob_fld BLOB NOT NULL
) engine=pbxt;
INSERT INTO t1 VALUES (
20071130
, "2007-11-30"
, "2007-11-30 16:30:19"
, "2007-11-
, "2007-11-30 16:30:19"
, "2007-11-30 16:30:19"
, "2007-11-
, "2007-11-
);
-- the "pure" select queries below work fine and return correct values
SELECT int_fld FROM t1;
SELECT date_fld FROM t1;
SELECT datetime_fld FROM t1;
SELECT timestamp_fld FROM t1;
SELECT char_fld FROM t1;
SELECT varchar_fld FROM t1;
SELECT text_fld FROM t1;
SELECT blob_fld FROM t1;
-- the last SELECT HOUR(blob_fld) FROM t1 fails
SELECT HOUR(int_fld) FROM t1;
SELECT HOUR(date_fld) FROM t1;
SELECT HOUR(datetime_fld) FROM t1;
SELECT HOUR(timestamp_fld) FROM t1;
SELECT HOUR(char_fld) FROM t1;
SELECT HOUR(varchar_fld) FROM t1;
SELECT HOUR(text_fld) FROM t1;
SELECT HOUR(blob_fld) FROM t1;
...
drizzle> SELECT HOUR(blob_fld) FROM t1;
ERROR 1686 (HY000): Received an invalid datetime value ''.
details:
fields text_fld and blob_fld have the following layout inside the engine: <text_fld-
after the query SELECT HOUR(text_fld) FROM t1; the <blob_fld-length> value gets zeroed (by the code outside of the engine) so the next query SELECT HOUR(blob_fld) FROM t1; sees a zero-length field... I guess the problem might be that drizzle's function assumes that the buffer to which the pointer is returned from teh engine to drizzle is own drizzle's buffer and appends zero-byte to the string before parsing it...
Related branches
- Drizzle Merge Team: Pending requested
-
Diff: 649 lines (+236/-49)13 files modifieddrizzled/function/time/dayofmonth.cc (+14/-3)
drizzled/function/time/dayofyear.cc (+14/-3)
drizzled/function/time/extract.cc (+29/-6)
drizzled/function/time/hour.cc (+21/-4)
drizzled/function/time/last_day.cc (+13/-3)
drizzled/function/time/microsecond.cc (+21/-4)
drizzled/function/time/minute.cc (+21/-4)
drizzled/function/time/month.cc (+14/-3)
drizzled/function/time/quarter.cc (+14/-3)
drizzled/function/time/second.cc (+21/-4)
drizzled/function/time/to_days.cc (+26/-6)
drizzled/function/time/weekday.cc (+14/-3)
drizzled/function/time/year.cc (+14/-3)
Changed in drizzle: | |
status: | New → Confirmed |
Changed in drizzle: | |
milestone: | 2010-05-10 → 2010-05-24 |
Changed in drizzle: | |
milestone: | 2010-05-24 → none |
Changed in drizzle: | |
assignee: | Jay Pipes (jaypipes) → nobody |
So, I'm looking into this, but what I'm wondering is if the bug is in the kernel code, why it doesn't show up with the InnoDB plugin? Any insights?