Copy/duplicate SQL row with blob/text, How do that

2019-05-26 15:21发布

First, sorry for my english, I'm French.

So, I would like to copy a SQL's row in the same table. But in my table, I've a 'text' column.

With this sql :

CREATE TEMPORARY TABLE produit2 ENGINE=MEMORY SELECT * FROM produit WHERE pdt_ID = 'IPSUMS';
UPDATE produit2 SET pdt_ID='ID_TEMP';
INSERT INTO produit SELECT * FROM produit2;
DROP TABLE produit2;

I've this error :

#1163 - The used table type doesn't support BLOB/TEXT columns

Here is my table :

pdt_ID varchar(6)
pdt_nom varchar(130)
pdt_stitre varchar(255)
pdt_accroche varchar(255)
pdt_desc text
pdt_img varchar(25)
pdt_pdf varchar(10)
pdt_garantie varchar(80)
edit_ID varchar(7)
scat_ID int(11)
pdt_asso1 char(3)
pdt_asso2 char(3) 
pdt_online tinyint(4)

It's possible to help me to duplicate row ? How?

Thank a lot to help me. Regards, Dangan

1条回答
Viruses.
2楼-- · 2019-05-26 15:36

You can't store TEXT-columns (which really are blobs) in memory tables. See here

Depending on your ultimate goal, you may insert a md5-hash of the TEXT-column instead to preserve entity identity. Otherwise you need to put pdt_desc and such into another table and refer to it's primary key - that will save you some storage/memory too.

查看更多
登录 后发表回答