Bug #30734 | InnoDB: inconsistent binary/varbinary comparison | ||
---|---|---|---|
Submitted: | 30 Aug 2007 19:45 | Modified: | 1 Sep 2007 16:00 |
Reporter: | Peter Gulutzan | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
Version: | 5.1.23-beta-debug | OS: | Linux (SUSE 10 64-bit) |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[30 Aug 2007 19:45]
Peter Gulutzan
[1 Sep 2007 16:00]
Heikki Tuuri
What is the correct behavior? Below we see that in 5.1, InnoDB does not pad BINARY/VARBINARY in comparisons. The comments in bug #28076 suggest that the bug is in MySQL that it passes the search key value sometimes padded with 0x00 though it apparently should not pad it. I am marking this bug report a duplicate of Bug#28076. data0type.ic in 5.1: /************************************************************************* Gets the padding character code for a type. */ UNIV_INLINE ulint dtype_get_pad_char( /*===============*/ /* out: padding character code, or ULINT_UNDEFINED if no padding specified */ ulint mtype, /* in: main type */ ulint prtype) /* in: precise type */ { switch (mtype) { case DATA_FIXBINARY: case DATA_BINARY: if (UNIV_UNLIKELY(dtype_get_charset_coll(prtype) == DATA_MYSQL_BINARY_CHARSET_COLL)) { /* Starting from 5.0.18, do not pad VARBINARY or BINARY columns. */ return(ULINT_UNDEFINED); } /* Fall through */ case DATA_CHAR: case DATA_VARCHAR: case DATA_MYSQL: case DATA_VARMYSQL: /* Space is the padding character for all char and binary strings, and starting from 5.0.3, also for TEXT strings. */ return(0x20); case DATA_BLOB: if (!(prtype & DATA_BINARY_TYPE)) { return(0x20); } /* Fall through */ default: /* No padding specified */ return(ULINT_UNDEFINED); } }