MySql - 不支持 BLOB/TEXT 列
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;
在 运行 过程中我收到以下错误消息:
The used table type doesn't support BLOB/TEXT columns
我已经看过 this 话题,但它对我没有帮助。
列中的类型如下:
lastName -> VARCHAR(255)
firstName -> VARCHAR(255)
zip -> VARCHAR(10)
当我从程序中排除 zip 时它会正常工作所以我猜 varchar 的长度有问题?
有没有人知道不将 zip 的 varchar 长度从 10 更改为 255 的解决方案?
发生率由常数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
和
16.3 The MEMORY Storage Engine
...
Support for variable-length data types (including BLOB and TEXT) not supported by MEMORY.
示例:
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
尝试:
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
我对 ENGINE=MEMORY 的经验是字符集也很重要。
varchar(65000) 和 charset latin1 工作; charset UTF8 没有
引擎=内存默认字符集=latin1
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;
在 运行 过程中我收到以下错误消息:
The used table type doesn't support BLOB/TEXT columns
我已经看过 this 话题,但它对我没有帮助。
列中的类型如下:
lastName -> VARCHAR(255)
firstName -> VARCHAR(255)
zip -> VARCHAR(10)
当我从程序中排除 zip 时它会正常工作所以我猜 varchar 的长度有问题?
有没有人知道不将 zip 的 varchar 长度从 10 更改为 255 的解决方案?
发生率由常数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
和
16.3 The MEMORY Storage Engine
...
Support for variable-length data types (including BLOB and TEXT) not supported by MEMORY.
示例:
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
尝试:
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
我对 ENGINE=MEMORY 的经验是字符集也很重要。 varchar(65000) 和 charset latin1 工作; charset UTF8 没有 引擎=内存默认字符集=latin1