summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorunknown <jimw@rama.(none)>2006-07-18 16:04:18 -0700
committerunknown <jimw@rama.(none)>2006-07-18 16:04:18 -0700
commit20c2ddaf0c51f4a9564f67e67d56ab8acf6f1dd9 (patch)
tree7a901fad8e45dd3cfa24659bf23114d4ef56c2ad /mysql-test/r
parenta7dddd3b67e70292c0813e80ad255f1dc2f3a867 (diff)
downloadmariadb-git-20c2ddaf0c51f4a9564f67e67d56ab8acf6f1dd9.tar.gz
Bug #19498: Inconsistent support for DEFAULT in TEXT columns
When a default of '' was specified for TEXT/BLOB columns, the specification was silently ignored. This is presumably to be nice to applications (or people) who generate their column definitions in a not-very-clever fashion. For clarity, doing this now results in a warning, or an error in strict mode. mysql-test/r/federated.result: Update results mysql-test/r/fulltext_distinct.result: Update results mysql-test/r/fulltext_update.result: Update results mysql-test/r/gis-rtree.result: Update results mysql-test/r/gis.result: Update results mysql-test/r/join_outer.result: Update results mysql-test/r/order_by.result: Update results mysql-test/r/type_blob.result: Add new results mysql-test/r/type_ranges.result: Update results mysql-test/t/type_blob.test: Add new test sql/field.cc: Issue a warning when setting '' as the default on a BLOB/TEXT column, and make it an error in strict mode. Also, clarify comments about when NO_DEFAULT_VALUE_FLAG is set.
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/federated.result4
-rw-r--r--mysql-test/r/fulltext_distinct.result2
-rw-r--r--mysql-test/r/fulltext_update.result2
-rw-r--r--mysql-test/r/gis-rtree.result6
-rw-r--r--mysql-test/r/gis.result2
-rw-r--r--mysql-test/r/join_outer.result2
-rw-r--r--mysql-test/r/order_by.result2
-rw-r--r--mysql-test/r/type_blob.result20
-rw-r--r--mysql-test/r/type_ranges.result3
9 files changed, 43 insertions, 0 deletions
diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result
index 709e44579e2..baf8641c9e9 100644
--- a/mysql-test/r/federated.result
+++ b/mysql-test/r/federated.result
@@ -967,6 +967,8 @@ CREATE TABLE federated.t1 (
`blurb` text default '',
PRIMARY KEY (blurb_id))
DEFAULT CHARSET=latin1;
+Warnings:
+Warning 1101 BLOB/TEXT column 'blurb' can't have a default value
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
`blurb_id` int NOT NULL DEFAULT 0,
@@ -975,6 +977,8 @@ PRIMARY KEY (blurb_id))
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
+Warnings:
+Warning 1101 BLOB/TEXT column 'blurb' can't have a default value
INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values.");
INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE.");
INSERT INTO federated.t1 VALUES (3, " A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. ");
diff --git a/mysql-test/r/fulltext_distinct.result b/mysql-test/r/fulltext_distinct.result
index de0668ff28c..7fd42fab646 100644
--- a/mysql-test/r/fulltext_distinct.result
+++ b/mysql-test/r/fulltext_distinct.result
@@ -8,6 +8,8 @@ KEY kt(tag),
KEY kv(value(15)),
FULLTEXT KEY kvf(value)
) ENGINE=MyISAM;
+Warnings:
+Warning 1101 BLOB/TEXT column 'value' can't have a default value
CREATE TABLE t2 (
id_t2 mediumint unsigned NOT NULL default '0',
id_t1 mediumint unsigned NOT NULL default '0',
diff --git a/mysql-test/r/fulltext_update.result b/mysql-test/r/fulltext_update.result
index 5d3f95b318c..4a615c88fdd 100644
--- a/mysql-test/r/fulltext_update.result
+++ b/mysql-test/r/fulltext_update.result
@@ -9,6 +9,8 @@ name VARCHAR(80) DEFAULT '' NOT NULL,
FULLTEXT(url,description,shortdesc,longdesc),
PRIMARY KEY(gnr)
);
+Warnings:
+Warning 1101 BLOB/TEXT column 'longdesc' can't have a default value
insert into test (url,shortdesc,longdesc,description,name) VALUES
("http:/test.at", "kurz", "lang","desc", "name");
insert into test (url,shortdesc,longdesc,description,name) VALUES
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index 28c59053435..b283d64395d 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -804,6 +804,8 @@ INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1, t2;
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`(32))) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+Warnings:
+Warning 1101 BLOB/TEXT column 'geometry' can't have a default value
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
-66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999,
@@ -820,6 +822,8 @@ CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1(32))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+Warnings:
+Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
@@ -834,6 +838,8 @@ CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1(32))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+Warnings:
+Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 7a0f689df36..e37dca9e86c 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -583,6 +583,8 @@ t1 CREATE TABLE `t1` (
drop table t1;
CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
geometry NOT NULL default '') ENGINE=MyISAM ;
+Warnings:
+Warning 1101 BLOB/TEXT column 'geo' can't have a default value
insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163
36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index eae023813b5..a983b32ba46 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -598,6 +598,8 @@ id int(11) DEFAULT '0' NOT NULL,
name tinytext DEFAULT '' NOT NULL,
UNIQUE id (id)
);
+Warnings:
+Warning 1101 BLOB/TEXT column 'name' can't have a default value
INSERT INTO t1 VALUES (1,'yes'),(2,'no');
CREATE TABLE t2 (
id int(11) DEFAULT '0' NOT NULL,
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index a36935a583d..9756ab49ac7 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -280,6 +280,8 @@ info text NOT NULL default '',
ipnr varchar(30) NOT NULL default '',
PRIMARY KEY (member_id)
) ENGINE=MyISAM PACK_KEYS=1;
+Warnings:
+Warning 1101 BLOB/TEXT column 'info' can't have a default value
insert into t1 (member_id) values (1),(2),(3);
select member_id, nickname, voornaam FROM t1
ORDER by lastchange_datum DESC LIMIT 2;
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 4fd220045c2..73b67a2241e 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -503,6 +503,8 @@ foobar boggle
fish 10
drop table t1;
create table t1 (id integer auto_increment unique,imagem LONGBLOB not null default '');
+Warnings:
+Warning 1101 BLOB/TEXT column 'imagem' can't have a default value
insert into t1 (id) values (1);
select
charset(load_file('../../std_data/words.dat')),
@@ -788,3 +790,21 @@ NULL
616100000000
620000000000
drop table t1;
+create table t1 (a text default '');
+Warnings:
+Warning 1101 BLOB/TEXT column 'a' can't have a default value
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values (default);
+select * from t1;
+a
+NULL
+drop table t1;
+set @@sql_mode='TRADITIONAL';
+create table t1 (a text default '');
+ERROR 42000: BLOB/TEXT column 'a' can't have a default value
+set @@sql_mode='';
+End of 5.0 tests
diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result
index bd89c09e94d..cfbe11b975e 100644
--- a/mysql-test/r/type_ranges.result
+++ b/mysql-test/r/type_ranges.result
@@ -38,6 +38,9 @@ KEY (ulong),
KEY (ulonglong,ulong),
KEY (options,flags)
);
+Warnings:
+Warning 1101 BLOB/TEXT column 'mediumblob_col' can't have a default value
+Warning 1101 BLOB/TEXT column 'longblob_col' can't have a default value
show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment
auto int(5) unsigned NULL NO PRI NULL auto_increment #