Access violation when changing a VARCHAR column size from 800 to 8000 characters.

archfrog's profile image archfrog posted 2 years ago in General Permalink

/ #1634496361: Access violation at address 00000000006E4981 in module 'heidisql.exe'. Read of address FFFFFFFFFFFFFFFF Message CharCode:13 Msg:256 /

This using the most recent version of HeidiSQL, just updated today, I believe. HeidiSQL doesn't crash, I just get the error instead of the desired change.

Please see the attached picture for a full table view.

This is rather unfortunate as I am in the middle of an urgent change to expand the size of the column.

1 attachment(s):
  • 2022-09-30-13_22_11-Greenshot
archfrog's profile image archfrog posted 2 years ago Permalink

I get the following error when trying with 'mysql' itself:

MariaDB [esdk]> alter table bookings modify cargo_description varchar(8000); ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs

I don't get it as the sum of the fields are nowhere near 64KB. But I guess I'm doing something wrong somewhere.

Is it so that VARCHAR(8000) allocates 32.000 bytes when using utf8mb4? I thought I had to allocate the extra space (four bytes per character)?

archfrog's profile image archfrog posted 2 years ago Permalink

"A variable-length string. M represents the maximum column length in characters. The range of M is 0 to 65,532. The effective maximum length of a VARCHAR is subject to the maximum row size and the character set used. For example, utf8 characters can require up to three bytes per character, so a VARCHAR column that uses the utf8 character set can be declared to be a maximum of 21,844 characters."

From https://mariadb.com/kb/en/varchar/. So, MariaDB does allocate N bytes per character, where N equals 4 for utf8mb4_xxx character encodings.

So this is my fault, but I guess HeidiSQL should react more sensibly than an access violation :-)

ansgar's profile image ansgar posted 2 years ago Permalink

Use TEXT (64KB max) type instead of VARCHAR for longer content. Or MEDIUMTEXT (16 MB), or LONGTEXT (4GB).

ansgar's profile image ansgar posted 2 years ago Permalink

That access violation is just in the log panel, right? Please ignore it. That does not harm your modification here.

archfrog's profile image archfrog posted 2 years ago Permalink

Yes, only in the log panel. Thanks, I'm back on track again. And thanks for HeidiSQL!

Please login to leave a reply, or register at first.