[MDEV-7988] Increase binary datatype limitation from 255 bytes to 65536 bytes Created: 2015-04-14  Updated: 2015-11-02

Status: Open
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Genry Uncij (Inactive) Assignee: Unassigned
Resolution: Unresolved Votes: 4
Labels: None


 Description   

In a project I'm working on, binary string 'varbinary' used as fixed array. Array elements change by INSERT(str,pos,len,newstr) function. Varbinary fields filled at insert with 0x00 (the zero byte) by setting DEFAULT option to '\0\0\0 ... \0'. The problem is that in my company use such programs, as Naviсat, which clears default '\0\0\0 ... \0' value at any table edit. Alternative - use datatype 'binary', that filled with 0x00 (the zero byte) by default. But its limited by 255 bytes only, error: "1074 - Column length too big for column 'row_array' (max = 255)". It will be great if limit of binary datatype increases to 65536 bytes or more.



 Comments   
Comment by Mikle [ 2015-04-25 ]

I use this method too. In my tables contains many columns like this: `comma` varbinary(20000) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 ... \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', with repetition of zeros many thousands of times. But I think it would be more effective to use varbinary and add new INSERT(str,pos,len,newstr) function, which will padded string with zeros to pos, if pos is not within the length of the string. Or add a new syntax for accessing the elements of string, like this: UPDATE `table` SET `comma`[4] = '1111' , which will write bytes starting from specified in brackets position, with autopadded string with zeros to position...

Comment by Daniel Black [ 2015-11-02 ]

I started to have a look.

The above patch works well for myisam.

For innodb the non-packed row means this is effectively limited by the innodb row limit (about 8K).

from sql/field.cc: Field_string::unpack it looks like there is a packed format that could support 64K, just need to find the appropriate places to pack/unpack it just like a varchar.

Is there really a need to go beyond 64K? If so it would need a new datatype from my limited understanding of the way things look.

so MYSQL_TYPE_STRING is used for BINARY, CHAR, SETS, old decimal (more?) so need to be really careful here.

Generated at Thu Feb 08 07:23:48 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.