summaryrefslogtreecommitdiff
path: root/mysql-test/t/information_schema.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/information_schema.test')
-rw-r--r--mysql-test/t/information_schema.test39
1 files changed, 39 insertions, 0 deletions
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 222b9652fca..4ae88736b98 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -934,7 +934,46 @@ SELECT MAX(table_name) FROM information_schema.tables;
SELECT table_name from information_schema.tables
WHERE table_name=(SELECT MAX(table_name)
FROM information_schema.tables);
+#
+# Bug #23037: Bug in field "Default" of query "SHOW COLUMNS FROM table"
+#
+# Note, MyISAM/InnoDB can't take more that 65532 chars, because the row
+# size is limited to 65535 bytes (BLOBs not counted)
+#
+--disable_warnings
+DROP TABLE IF EXISTS bug23037;
+DROP FUNCTION IF EXISTS get_value;
+--enable_warnings
+--disable_query_log
+DELIMITER |;
+CREATE FUNCTION get_value()
+ RETURNS TEXT
+ DETERMINISTIC
+BEGIN
+ DECLARE col1, col2, col3, col4, col6 CHAR(255);
+ DECLARE default_val VARCHAR(65532);
+ DECLARE done INT DEFAULT 0;
+ DECLARE cur1 CURSOR FOR SHOW COLUMNS FROM bug23037;
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+ OPEN cur1;
+ FETCH cur1 INTO col1, col2, col3, col4, default_val, col6;
+ CLOSE cur1;
+ RETURN default_val;
+end|
+DELIMITER ;|
+
+let $body=`SELECT REPEAT('A', 65532)`;
+eval CREATE TABLE bug23037(fld1 VARCHAR(65532) CHARACTER SET latin1 DEFAULT "$body");
+--enable_query_log
+
+SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037';
+
+SELECT MD5(get_value());
+
+SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT), COLUMN_DEFAULT=get_value() FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037';
+DROP TABLE bug23037;
+DROP FUNCTION get_value;
--echo End of 5.0 tests.
#
# Show engines