Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySql - doesn't support BLOB/TEXT columns

create temporary table if not exists tmp engine=memory 
SELECT id, CONCAT(TRIM(lastName),TRIM(firstName),TRIM(zip)) AS identify
FROM customers 
GROUP BY identify;

While running the procedure I get the following error message:

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

I already saw this thread but it didn't help me.

The types on the columns are the following:

lastName -> VARCHAR(255)
firstName -> VARCHAR(255)
zip -> VARCHAR(10)

when I exclude the zip from the procedure it works as It should so I guess there is a problem with the length of the varchar?

Does anyone knew a solution without changing the varchar length of zip from 10 to 255?

like image 695
rockZ Avatar asked May 07 '26 22:05

rockZ


1 Answers

Incidence is presented by the value of the constant CONVERT_IF_BIGGER_TO_BLOB:

/**
  CHAR and VARCHAR fields longer than this number of characters are converted
  to BLOB.
  Non-character fields longer than this number of bytes are converted to BLOB.
  Comparisons should be '>' or '<='.
*/
#define CONVERT_IF_BIGGER_TO_BLOB 512   /* Used for CREATE ... SELECT */

mysql-server/sql/sql_const.h::52

and

16.3 The MEMORY Storage Engine

  • ...

  • Support for variable-length data types (including BLOB and TEXT) not supported by MEMORY.

Example:

mysql> DROP TEMPORARY TABLE IF EXISTS `tmp`;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TEMPORARY TABLE IF NOT EXISTS `tmp` ENGINE=MEMORY
    -> SELECT SPACE(512) `tmp_col`;
Query OK, 1 row affected (0.00 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> DROP TEMPORARY TABLE IF EXISTS `tmp`;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TEMPORARY TABLE IF NOT EXISTS `tmp` ENGINE=MEMORY
    -> SELECT SPACE(513) `tmp_col`;
ERROR 1163 (42000): The used table type doesn't support BLOB/TEXT columns

Try:

mysql> DROP TABLE IF EXISTS `tmp`, `customers`;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE IF NOT EXISTS `customers` (
    ->   `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
    ->   `lastName` VARCHAR(255) NOT NULL,
    ->   `firstName` VARCHAR(255) NOT NULL,
    ->   `zip` VARCHAR(10) NOT NULL
    -> );
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TEMPORARY TABLE IF NOT EXISTS `tmp` (
    ->   `id` BIGINT UNSIGNED NOT NULL PRIMARY KEY,
    ->   `identify` VARCHAR(520) NOT NULL
    -> ) ENGINE=MEMORY;
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO `tmp`
    -> SELECT `id`, CONCAT(TRIM(`lastName`),
    ->                     TRIM(`firstName`),
    ->                     TRIM(`zip`)) `identify`
    -> FROM `customers`
    -> GROUP BY `id`, `identify`;
Query OK, 0 rows affected (0.00 sec)
Records: 0  Duplicates: 0  Warnings: 0
like image 175
wchiquito Avatar answered May 10 '26 12:05

wchiquito



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!