Data truncated for column 'TABLE_COMMENT'
Posted by: - -
Date: May 27, 2010 05:30AM

Hi,

I want to insert a record using the Auto_increment value read from information_schema database. It's the only way I found to insert twice the auto_increment. However, a warning is thrown about data truncation on information_schema.TABLES.TABLE_COMMENT column.

Test case:
(MySQL 5.0, sql_mode='')

CREATE TABLE sample (
id int(11) NOT NULL auto_increment,
name varchar(100),
link_id int(11) NOT NULL,
PRIMARY KEY (id),
CONSTRAINT link_id_constraint FOREIGN KEY (link_id) REFERENCES sample (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;
INSERT INTO sample(name, link_id)
VALUES('x',(SELECT Auto_increment FROM information_schema.tables WHERE table_schema=SCHEMA() AND table_name='sample'));

Warning is:
Warning Code : 1265
Data truncated for column 'TABLE_COMMENT' at row 1

Value of TABLE_COMMENT column for this table is: "InnoDB free: 191488 kB; (`link_id`) REFER `ks_dbsynctest1/sample`(`id`) ON UPDAT"

If I remove "ON DELETE CASCADE ON UPDATE CASCADE" on CONSTRAINT creation script, all works since TABLE_COMMENT is shorter.

My question is: why do I get this error whereas I don't touch TABLE_COMMENT value ?

Is there a way to get rid of this warning ?

Subsidiary question: is there another way to insert the auto_increment twice ?

Thanks

Sylvain



Edited 1 time(s). Last edit at 05/27/2010 06:22AM by - -.

Options: ReplyQuote


Subject
Views
Written By
Posted
Data truncated for column 'TABLE_COMMENT'
11096
- -
May 27, 2010 05:30AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.