List:General Discussion« Previous MessageNext Message »
From:Harald Fuchs Date:August 16 2002 2:46pm
Subject:Re: 4.0.x bug with LONGTEXT?
View as plain text  
In article <200208161402.g7GE21I26871@stripped>,
Victoria Reznichenko <victoria.reznichenko@stripped> writes:

> Harald,
> Thursday, August 15, 2002, 4:02:44 PM, you wrote:

HF> I think I've found a bug in the handling of large INSERTs/UPDATEs
HF> (MySQL 4.0.2, Intel/Linux).

HF> Consider the following:

HF> CREATE TABLE IF NOT EXISTS tbl1 (
HF> id INT UNSIGNED NOT NULL AUTO_INCREMENT,
HF> txt LONGTEXT NOT NULL,
HF> PRIMARY KEY (id)
HF> ) TYPE=Innodb;

HF> INSERT INTO tbl1 (txt) VALUES (LOAD_FILE("/var/tmp/out"));

> [skip]

HF> If I do

HF> UPDATE tbl1
HF> SET txt = CONCAT(txt, LOAD_FILE("/var/tmp/out"))
HF> WHERE id = 1;

HF> (i.e. duplicating txt), SELECT returns

HF> +----+-----+
HF> | id | len |
HF> +----+-----+
HF> |  1 |   0 |
HF> +----+-----+

HF> According to the manual, LOAD_FILE returns NULL if the file is too
HF> large, but apparently this isn't the case here.

> In your case total text length is bigger than max_allowed_packet, that
> is why you've got len=0

Victoria,

I agree that this must be the case, but it is contrary to what the
manual says:

`LOAD_FILE(file_name)'
     Reads the file and returns the file contents as a string.  The file
     must be on the server, you must specify the full pathname to the
     file, and you must have the `FILE' privilege.  The file must be
     readable by all and be smaller than `max_allowed_packet'.
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     If the file doesn't exist or can't be read due to one of the above
     reasons, the function returns `NULL': ...

The manual states clearly that _the file_ must be smaller than
max_allowed_packet (which it is), *not* the total text length.

I think this behaviour is highly unintuitive - after all, I don't
transfer more than max_allowed_packet bytes to the server.  

So I'd suggest that this should be documented in the manual.
Thread
4.0.x bug with LONGTEXT?Harald Fuchs15 Aug
  • Re: 4.0.x bug with LONGTEXT?Victoria Reznichenko16 Aug
Re: 4.0.x bug with LONGTEXT?Harald Fuchs16 Aug
  • Re: Re: 4.0.x bug with LONGTEXT?Victoria Reznichenko19 Aug
Re: 4.0.x bug with LONGTEXT?Harald Fuchs20 Aug
  • max_allowed_packet (was: Re: 4.0.x bug with LONGTEXT?)Roger Baklund20 Aug
RE: max_allowed_packet (was: Re: 4.0.x bug with LONGTEXT?)Luc Foisy20 Aug
  • Re: max_allowed_packet (was: Re: 4.0.x bug with LONGTEXT?)Roger Baklund20 Aug
    • Re: Re: max_allowed_packet (was: Re: 4.0.x bug with LONGTEXT?)Victoria Reznichenko21 Aug
      • Re: max_allowed_packet (was: Re: 4.0.x bug with LONGTEXT?)Roger Baklund21 Aug