错误代码:1118行大小太大(> 65535)

时间:2014-07-22 11:01:27

标签: mysql sql

CREATE TABLE IF NOT EXISTS client_details (
id BIGINT AUTO_INCREMENT PRIMARY KEY,

client_description VARCHAR(1024),
reuse_refresh_tokens BOOLEAN NOT NULL DEFAULT 1,
dynamically_registered BOOLEAN NOT NULL DEFAULT 0,
allow_introspection BOOLEAN NOT NULL DEFAULT 0,
id_token_validity_seconds BIGINT NOT NULL DEFAULT 600,

client_id VARCHAR(256),
client_secret VARCHAR(2048),
access_token_validity_seconds BIGINT,
refresh_token_validity_seconds BIGINT,

application_type VARCHAR(256),
client_name VARCHAR(256),
token_endpoint_auth_method VARCHAR(256),
subject_type VARCHAR(256),

logo_uri VARCHAR(2048),
policy_uri VARCHAR(2048),
client_uri VARCHAR(2048),
tos_uri VARCHAR(2048),

jwks_uri VARCHAR(2048),
sector_identifier_uri VARCHAR(2048),

request_object_signing_alg VARCHAR(256),

user_info_signed_response_alg VARCHAR(256),
user_info_encrypted_response_alg VARCHAR(256),
user_info_encrypted_response_enc VARCHAR(256),

id_token_signed_response_alg VARCHAR(256),
id_token_encrypted_response_alg VARCHAR(256),
id_token_encrypted_response_enc VARCHAR(256),

token_endpoint_auth_signing_alg VARCHAR(256),

default_max_age BIGINT,
require_auth_time BOOLEAN,
created_at TIMESTAMP NULL,
initiate_login_uri VARCHAR(2048),
post_logout_redirect_uri VARCHAR(2048),
unique(client_id)
);

===============
我想用MySQL Workbench创建一个表,但是有一个错误:

  

“错误代码:1118。行大小太大。使用的表类型的最大行大小,不计算BLOB,是65535.您必须将某些列更改为TEXT或BLOB”

我不明白行大小如何大于65535。

请帮忙吗?

2 个答案:

答案 0 :(得分:1)

虽然有各种方法可以捏造解决方案,但您的方法实在是太天真了,如果您找到刚才遇到的问题的解决方法,那么您将存储未来的问题。

您应首先分析数据并适当调整字段 。不只是指定数据可能的最大大小。

为什么桌面上有2个唯一标识符?

将较大的字段移动到单独的表中将有助于提高性能:

CREATE TABLE IF NOT EXISTS client_details (
 id BIGINT AUTO_INCREMENT PRIMARY KEY,
 client_description VARCHAR(1024),
 reuse_refresh_tokens BOOLEAN NOT NULL DEFAULT 1,
 dynamically_registered BOOLEAN NOT NULL DEFAULT 0,
 allow_introspection BOOLEAN NOT NULL DEFAULT 0,
 id_token_validity_seconds BIGINT NOT NULL DEFAULT 600,
 client_id VARCHAR(256),
 client_secret VARCHAR(2048),
 access_token_validity_seconds BIGINT,
 refresh_token_validity_seconds BIGINT,
 application_type VARCHAR(256),   
          -- why is this not an enum or foreign key?
 client_name VARCHAR(256),
 token_endpoint_auth_method VARCHAR(256),
 subject_type VARCHAR(256),
 request_object_signing_alg VARCHAR(256),
 user_info_signed_response_alg VARCHAR(256),   
          -- is this really a single value per client?
 user_info_encrypted_response_alg VARCHAR(256), 
 user_info_encrypted_response_enc VARCHAR(256), 
 id_token_signed_response_alg VARCHAR(256),
 id_token_encrypted_response_alg VARCHAR(256),
 id_token_encrypted_response_enc VARCHAR(256),
 token_endpoint_auth_signing_alg VARCHAR(256),
 default_max_age BIGINT,
 require_auth_time BOOLEAN,
 created_at TIMESTAMP NULL,   
             -- why is NULL allowed?
 unique(client_id)
);

CREATE TABLE IF NOT EXISTS client_uris (
   client_details_id BIGINT REFERENCES client_uris(id),
   role ENUM (
         'logo',
         'policy',
         'client',
         'tos',
         'jwks',
         'sector_identifier',
         'initiate_login',
         'post_logout_redirect') NOT NULL,
   uri TINYTEXT,
   UNIQUE(client_details_id, role)
);

答案 1 :(得分:0)

表中所有字段的总大小超过限制,65535字节,这就是您收到此错误的原因。

对于长字符串,您应该使用文本类型而不是varchar。用文本替换所有varchar,它应该可以工作。

http://dev.mysql.com/doc/refman/5.0/en/column-count-limit.html

相关问题