Row size too large

Why isn’t my code working?


CREATE TABLE article(
id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT ,
title VARCHAR( 250 ) NOT NULL UNIQUE ,
subtitle VARCHAR( 250 ) ,
article_date DATE NOT NULL ,
author VARCHAR( 100 ) ,
body VARCHAR( 65000 ) NOT NULL ,
end_notes VARCHAR( 10000 ) ,
created_on DATETIME NOT NULL ,
updated_on DATETIME,
PRIMARY KEY ( id )
)

MySQL said: Documentation
#1118 - Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs

I would like the body field to be the maximum VARCHAR size of 65,535 to hold really long articles. (I estimate this should hold up to about 40 pages?!) :-/

I tried using VARCHAR and also VARCHAR() but nothing works…

Debbie

use TEXT

Why?

And why isn’t my attempts at the VARCHAR working?

Debbie

because TEXT is intended for large text columns

because you’re exceeding the maximum row size

Then what is VARCHAR intended for?

because you’re exceeding the maximum row size

But VARCHAR is supposed to go up to 65,535 so why doesn’t

VARCHAR(65,535) 

work?!

Debbie

Smaller text columns

But VARCHAR is supposed to go up to 65,535 so why doesn’t

VARCHAR(65,535) 

work?!

It works. It doesn’t give you an error on the column. But there is a limit for the entire table row size (the sum of all column sizes) as well.
Like the error tells you

The maximum row size for the used table type, not counting BLOBs, is 65535.

So you could create a column with varchar(65535) but it would have to be the only column in the table.

“I see!” said the blind man! :smiley:

Thanks for helping me get it!

Debbie