Bug #9735 mysql_fetch_fields() acts strange on LONGBLOB/LONGTEXT
Submitted: 7 Apr 2005 22:16 Modified: 21 Jul 2005 4:38
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.10 OS:Linux (linux)
Assigned to: Konstantin Osipov CPU Architecture:Any

[7 Apr 2005 22:16] Hartmut Holzgraefe
Description:
When doing a mysql_fetch_fields() on a

  SELECT mediumtextfield, longtextfield FROM table

the two field structures returned are only distinguishable by the filednames,
all other meta information is the same.

Especially the field type is always MYSQL_TYPE_BLOB (252) whereas i'd 
expect it to be MYSQL_TYPE_MEDIUM_BLOB (250) / MYSQL_TYPE_LONG_BLOB (251).
But at least for the shorter BLOB/TEXT variants field->length shows the right length
(up to MEDIUM...), LONGTEXT and LONGBLOB though have the same length value
as the MEDIUM types (16M chars).

I checked the transfered network data, whatever causes this happens on the server
side already.

Looks like the following quote from the manual is not really true:

LONGBLOB
LONGTEXT
    A BLOB or TEXT column with a maximum length of 4,294,967,295 or 4GB (2^32 - 1) characters. Up to MySQL 3.23, the client/server protocol and MyISAM tables had a limit of 16MB per communication packet / table row. From MySQL 4.0, the maximum allowed length of LONGBLOB or LONGTEXT columns depends on the configured maximum packet size in the client/server protocol and available memory.

How to repeat:
check mysql_fetch_fields() results for MEDIUMBLOB and LONGBLOB columns

Suggested fix:
either fix transfered length values (and maybe type) or have better documentation 
about whats going on
[13 Jul 2005 22:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/27033
[14 Jul 2005 10:47] Alexander Barkov
Ok to push.
[14 Jul 2005 11:14] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/27063
[14 Jul 2005 11:16] Konstantin Osipov
Fixed in 4.1.14/5.1.10
[21 Jul 2005 4:38] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Documented in 4.1.14 and 5.0.10 changelogs. Closed.