summaryrefslogtreecommitdiff
path: root/sql/sql_const.h
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-10-18 15:14:39 +0200
committerSergei Golubchik <serg@mariadb.org>2017-10-18 15:14:39 +0200
commitda4503e956ee067947e504c6e73052d9d906742c (patch)
treea70bbc33f0411ef29c347a570d8253445d8013e4 /sql/sql_const.h
parentbabbf8c6fc6da92cd1b2bb23f04e996f84b0ca1a (diff)
parentb000e169562697aa072600695d4f0c0412f94f4f (diff)
downloadmariadb-git-da4503e956ee067947e504c6e73052d9d906742c.tar.gz
Merge branch '5.5' into 10.0
Diffstat (limited to 'sql/sql_const.h')
-rw-r--r--sql/sql_const.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/sql/sql_const.h b/sql/sql_const.h
index da2eef1b441..c37d8dd68f7 100644
--- a/sql/sql_const.h
+++ b/sql/sql_const.h
@@ -45,7 +45,18 @@
#define MAX_MBWIDTH 3 /* Max multibyte sequence */
#define MAX_FILENAME_MBWIDTH 5
#define MAX_FIELD_CHARLENGTH 255
-#define MAX_FIELD_VARCHARLENGTH 65535
+/*
+ In MAX_FIELD_VARCHARLENGTH we reserve extra bytes for the overhead:
+ - 2 bytes for the length
+ - 1 byte for NULL bits
+ to avoid the "Row size too large" error for these three corner definitions:
+ CREATE TABLE t1 (c VARBINARY(65533));
+ CREATE TABLE t1 (c VARBINARY(65534));
+ CREATE TABLE t1 (c VARBINARY(65535));
+ Like VARCHAR(65536), they will be converted to BLOB automatically
+ in non-sctict mode.
+*/
+#define MAX_FIELD_VARCHARLENGTH (65535-2-1)
#define MAX_FIELD_BLOBLENGTH UINT_MAX32 /* cf field_blob::get_length() */
#define CONVERT_IF_BIGGER_TO_BLOB 512 /* Threshold *in characters* */