Skip to content

Commit d8ba99c

Browse files
author
HaixLi
committed
WL#6263 Remove limited YEAR(2) support
Description: ------------ This WL will remove YEAR(2) cloumn. It supports: F1: Remove some old codes about YEAR(2). F2: Must not create YEAR(x!=4) column. Only support YEAR/YEAR(4) column. F3: Must not ALTER TABLE a column to YEAR(x!=4) column. F4: Run DML statements on existent legacy YEAR(X!=4) column will be given a error. F5: Run SHOW CREATE TABLE statement on existent legacy YEAR(X!=4) column will be given a warning. F6: Must not replicate CREATE YEAR(x!=4) column from 5.5 or 5.1 to this WL.
1 parent 5d7c2e2 commit d8ba99c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+457
-853
lines changed

mysql-test/include/ctype_numconv.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
11361136
select hex(concat(a)), a from t1;
11371137
drop table t1;
11381138

1139-
create table t1 (a year(2));
1139+
create table t1 (a year(4));
11401140
insert into t1 values (1);
11411141
select hex(concat(a)) from t1;
11421142
create table t2 as select concat(a) from t1;
@@ -1445,7 +1445,7 @@ select hex(a) from v1;
14451445
drop table t1;
14461446
drop view v1;
14471447

1448-
create table t1 (a year(2));
1448+
create table t1 (a year(4));
14491449
insert into t1 values (1);
14501450
create view v1(a) as select concat(a) from t1;
14511451
show columns from v1;

mysql-test/include/wl6219-engine.test

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,24 @@ eval SET session default_storage_engine=$engine_type;
1414

1515
--echo # Test for warnings on column creation
1616

17-
let $i= 5;
18-
19-
while($i) {
20-
eval CREATE TABLE t1 (y YEAR($i) NOT NULL);
21-
SHOW CREATE TABLE t1;
22-
DROP TABLE t1;
17+
CREATE TABLE t1 (y YEAR(4) NOT NULL);
18+
SHOW CREATE TABLE t1;
19+
DROP TABLE t1;
2320

2421
--error ER_PARSE_ERROR
25-
eval CREATE TABLE t1 (y YEAR(-$i) NOT NULL);
26-
dec $i;
27-
}
22+
CREATE TABLE t1 (y YEAR(-4) NOT NULL);
23+
2824

25+
--error ER_INVALID_YEAR_COLUMN_LENGTH
2926
CREATE TABLE t1 (y YEAR(0) NOT NULL);
30-
SHOW CREATE TABLE t1;
31-
DROP TABLE t1;
27+
--error ER_INVALID_YEAR_COLUMN_LENGTH
28+
CREATE TABLE t1 (y YEAR(1) NOT NULL);
29+
--error ER_INVALID_YEAR_COLUMN_LENGTH
30+
CREATE TABLE t1 (y YEAR(2) NOT NULL);
31+
--error ER_INVALID_YEAR_COLUMN_LENGTH
32+
CREATE TABLE t1 (y YEAR(5) NOT NULL);
33+
--error ER_INVALID_YEAR_COLUMN_LENGTH
34+
CREATE TABLE t1 (y YEAR(10240) NOT NULL);
3235

3336
--error ER_PARSE_ERROR
3437
CREATE TABLE t1 (y YEAR(-1) NOT NULL);
@@ -46,12 +49,10 @@ CREATE TABLE t1 (y YEAR('a') NOT NULL);
4649
CREATE TABLE t1 (y YEAR('-a') NOT NULL);
4750

4851

49-
--error ER_TOO_BIG_DISPLAYWIDTH
52+
--error ER_INVALID_YEAR_COLUMN_LENGTH
5053
CREATE TABLE t1 (y YEAR(4294967296) NOT NULL);
51-
54+
--error ER_INVALID_YEAR_COLUMN_LENGTH
5255
CREATE TABLE t1 (y YEAR(4294967295) NOT NULL);
53-
SHOW CREATE TABLE t1;
54-
DROP TABLE t1;
5556

5657
--echo # Test for default column width value
5758

@@ -68,14 +69,17 @@ CREATE TABLE t1 (i INT NOT NULL);
6869

6970
--echo # Try to create new YEAR(2) column with ALTER TABLE
7071

72+
--error ER_INVALID_YEAR_COLUMN_LENGTH
7173
ALTER TABLE t1 ADD COLUMN y YEAR(2) NOT NULL;
7274
SHOW CREATE TABLE t1;
7375

7476
--echo # Try to convert YEAR(4) column to YEAR(2) with ALTER TABLE
7577

78+
--error ER_INVALID_YEAR_COLUMN_LENGTH
7679
ALTER TABLE t1 MODIFY COLUMN y YEAR(2) NOT NULL;
7780
SHOW CREATE TABLE t1;
7881

82+
--error ER_INVALID_YEAR_COLUMN_LENGTH
7983
ALTER TABLE t1 MODIFY COLUMN i YEAR(2) NOT NULL;
8084
SHOW CREATE TABLE t1;
8185
ALTER TABLE t1 MODIFY COLUMN i INT NOT NULL;

mysql-test/r/ctype_binary.result

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,9 +2024,7 @@ hex(concat(a)) a
20242024
30303030303030303030303030303030313030302E31 00000000000000001000.1
20252025
30303030303030303030303030303031303030302E31 00000000000000010000.1
20262026
drop table t1;
2027-
create table t1 (a year(2));
2028-
Warnings:
2029-
Warning 1818 YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
2027+
create table t1 (a year(4));
20302028
insert into t1 values (1);
20312029
select hex(concat(a)) from t1;
20322030
hex(concat(a))
@@ -2341,9 +2339,7 @@ hex(a)
23412339
30303030303030303030303030303031303030302E31
23422340
drop table t1;
23432341
drop view v1;
2344-
create table t1 (a year(2));
2345-
Warnings:
2346-
Warning 1818 YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
2342+
create table t1 (a year(4));
23472343
insert into t1 values (1);
23482344
create view v1(a) as select concat(a) from t1;
23492345
show columns from v1;

mysql-test/r/ctype_cp1251.result

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2416,9 +2416,7 @@ hex(concat(a)) a
24162416
30303030303030303030303030303030313030302E31 00000000000000001000.1
24172417
30303030303030303030303030303031303030302E31 00000000000000010000.1
24182418
drop table t1;
2419-
create table t1 (a year(2));
2420-
Warnings:
2421-
Warning 1818 YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
2419+
create table t1 (a year(4));
24222420
insert into t1 values (1);
24232421
select hex(concat(a)) from t1;
24242422
hex(concat(a))
@@ -2733,9 +2731,7 @@ hex(a)
27332731
30303030303030303030303030303031303030302E31
27342732
drop table t1;
27352733
drop view v1;
2736-
create table t1 (a year(2));
2737-
Warnings:
2738-
Warning 1818 YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
2734+
create table t1 (a year(4));
27392735
insert into t1 values (1);
27402736
create view v1(a) as select concat(a) from t1;
27412737
show columns from v1;

mysql-test/r/ctype_latin1.result

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2443,9 +2443,7 @@ hex(concat(a)) a
24432443
30303030303030303030303030303030313030302E31 00000000000000001000.1
24442444
30303030303030303030303030303031303030302E31 00000000000000010000.1
24452445
drop table t1;
2446-
create table t1 (a year(2));
2447-
Warnings:
2448-
Warning 1818 YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
2446+
create table t1 (a year(4));
24492447
insert into t1 values (1);
24502448
select hex(concat(a)) from t1;
24512449
hex(concat(a))
@@ -2760,9 +2758,7 @@ hex(a)
27602758
30303030303030303030303030303031303030302E31
27612759
drop table t1;
27622760
drop view v1;
2763-
create table t1 (a year(2));
2764-
Warnings:
2765-
Warning 1818 YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
2761+
create table t1 (a year(4));
27662762
insert into t1 values (1);
27672763
create view v1(a) as select concat(a) from t1;
27682764
show columns from v1;

mysql-test/r/ctype_ucs.result

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3377,9 +3377,7 @@ hex(concat(a)) a
33773377
00300030003000300030003000300030003000300030003000300030003000300031003000300030002E0031 00000000000000001000.1
33783378
00300030003000300030003000300030003000300030003000300030003000310030003000300030002E0031 00000000000000010000.1
33793379
drop table t1;
3380-
create table t1 (a year(2));
3381-
Warnings:
3382-
Warning 1818 YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
3380+
create table t1 (a year(4));
33833381
insert into t1 values (1);
33843382
select hex(concat(a)) from t1;
33853383
hex(concat(a))
@@ -3694,9 +3692,7 @@ hex(a)
36943692
00300030003000300030003000300030003000300030003000300030003000310030003000300030002E0031
36953693
drop table t1;
36963694
drop view v1;
3697-
create table t1 (a year(2));
3698-
Warnings:
3699-
Warning 1818 YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
3695+
create table t1 (a year(4));
37003696
insert into t1 values (1);
37013697
create view v1(a) as select concat(a) from t1;
37023698
show columns from v1;

mysql-test/r/ctype_utf8.result

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4294,9 +4294,7 @@ hex(concat(a)) a
42944294
30303030303030303030303030303030313030302E31 00000000000000001000.1
42954295
30303030303030303030303030303031303030302E31 00000000000000010000.1
42964296
drop table t1;
4297-
create table t1 (a year(2));
4298-
Warnings:
4299-
Warning 1818 YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
4297+
create table t1 (a year(4));
43004298
insert into t1 values (1);
43014299
select hex(concat(a)) from t1;
43024300
hex(concat(a))
@@ -4611,9 +4609,7 @@ hex(a)
46114609
30303030303030303030303030303031303030302E31
46124610
drop table t1;
46134611
drop view v1;
4614-
create table t1 (a year(2));
4615-
Warnings:
4616-
Warning 1818 YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
4612+
create table t1 (a year(4));
46174613
insert into t1 values (1);
46184614
create view v1(a) as select concat(a) from t1;
46194615
show columns from v1;

mysql-test/r/func_group.result

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,10 +1626,9 @@ max i
16261626
DROP TABLE t1;
16271627
#
16281628
# Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
1629+
# WL#6263: Remove year(2)
16291630
#
1630-
create table t1 (f1 year(2), f2 year(4), f3 date, f4 datetime);
1631-
Warnings:
1632-
Warning 1818 YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
1631+
create table t1 (f1 year(4), f2 year(4), f3 date, f4 datetime);
16331632
insert into t1 values
16341633
(98,1998,19980101,"1998-01-01 00:00:00"),
16351634
('00',2000,20000101,"2000-01-01 00:00:01"),

mysql-test/r/mysqlcheck.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ test.bug47205
395395
error : Table rebuild required. Please do "ALTER TABLE `bug47205` FORCE" or dump/reload to fix it!
396396

397397
Repairing tables
398+
bug47205
399+
Running : ALTER TABLE `bug47205` FORCE
400+
status : OK
398401
# Table should now be ok
399402
CHECK TABLE bug47205 FOR UPGRADE;
400403
Table Op Msg_type Msg_text

mysql-test/r/partition_exchange.result

Lines changed: 12 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
77
# Same definition (both have ROW_FORMAT set)
88
CREATE TABLE t1 (
99
id int(11) NOT NULL AUTO_INCREMENT,
10-
year year(2) DEFAULT NULL,
10+
year year(4) DEFAULT NULL,
1111
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
1212
PRIMARY KEY (id)
1313
) ENGINE=InnoDB ROW_FORMAT=COMPACT
1414
PARTITION BY HASH (id)
1515
PARTITIONS 2;
16-
Warnings:
17-
Warning 1818 YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
1816
CREATE TABLE t2 LIKE t1;
1917
ALTER TABLE t2 REMOVE PARTITIONING;
2018
SHOW CREATE TABLE t1;
@@ -84,14 +82,10 @@ DROP TABLE t2;
8482
# Only the partitioned table have ROW_FORMAT set.
8583
CREATE TABLE t2 (
8684
id int(11) NOT NULL AUTO_INCREMENT,
87-
year year(2) DEFAULT NULL,
85+
year year(4) DEFAULT NULL,
8886
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
8987
PRIMARY KEY (id)
9088
) ENGINE=InnoDB;
91-
Warnings:
92-
Level Warning
93-
Code 1818
94-
Message YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
9589
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
9690
SHOW CREATE TABLE t1;
9791
Table t1
@@ -128,26 +122,18 @@ CREATE_OPTIONS
128122
DROP TABLE t1, t2;
129123
CREATE TABLE t1 (
130124
id int(11) NOT NULL AUTO_INCREMENT,
131-
year year(2) DEFAULT NULL,
125+
year year(4) DEFAULT NULL,
132126
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
133127
PRIMARY KEY (id)
134128
) ENGINE=InnoDB
135129
PARTITION BY HASH (id)
136130
PARTITIONS 2;
137-
Warnings:
138-
Level Warning
139-
Code 1818
140-
Message YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
141131
CREATE TABLE t2 (
142132
id int(11) NOT NULL AUTO_INCREMENT,
143-
year year(2) DEFAULT NULL,
133+
year year(4) DEFAULT NULL,
144134
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
145135
PRIMARY KEY (id)
146136
) ENGINE=InnoDB ROW_FORMAT = COMPACT;
147-
Warnings:
148-
Level Warning
149-
Code 1818
150-
Message YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
151137
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
152138
SHOW CREATE TABLE t1;
153139
Table t1
@@ -184,26 +170,18 @@ CREATE_OPTIONS row_format=COMPACT
184170
DROP TABLE t1, t2;
185171
CREATE TABLE t1 (
186172
id int(11) NOT NULL AUTO_INCREMENT,
187-
year year(2) DEFAULT NULL,
173+
year year(4) DEFAULT NULL,
188174
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
189175
PRIMARY KEY (id)
190176
) ENGINE=InnoDB
191177
PARTITION BY HASH (id)
192178
PARTITIONS 2;
193-
Warnings:
194-
Level Warning
195-
Code 1818
196-
Message YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
197179
CREATE TABLE t2 (
198180
id int(11) NOT NULL AUTO_INCREMENT,
199-
year year(2) DEFAULT NULL,
181+
year year(4) DEFAULT NULL,
200182
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
201183
PRIMARY KEY (id)
202184
) ENGINE=InnoDB;
203-
Warnings:
204-
Level Warning
205-
Code 1818
206-
Message YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
207185
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
208186
SHOW CREATE TABLE t1;
209187
Table t1
@@ -240,26 +218,18 @@ CREATE_OPTIONS
240218
DROP TABLE t1, t2;
241219
CREATE TABLE t1 (
242220
id int(11) NOT NULL AUTO_INCREMENT,
243-
year year(2) DEFAULT NULL,
221+
year year(4) DEFAULT NULL,
244222
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
245223
PRIMARY KEY (id)
246224
) ENGINE=InnoDB ROW_FORMAT = REDUNDANT
247225
PARTITION BY HASH (id)
248226
PARTITIONS 2;
249-
Warnings:
250-
Level Warning
251-
Code 1818
252-
Message YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
253227
CREATE TABLE t2 (
254228
id int(11) NOT NULL AUTO_INCREMENT,
255-
year year(2) DEFAULT NULL,
229+
year year(4) DEFAULT NULL,
256230
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
257231
PRIMARY KEY (id)
258232
) ENGINE=InnoDB ROW_FORMAT = REDUNDANT;
259-
Warnings:
260-
Level Warning
261-
Code 1818
262-
Message YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
263233
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
264234
SHOW CREATE TABLE t1;
265235
Table t1
@@ -296,26 +266,18 @@ CREATE_OPTIONS row_format=REDUNDANT
296266
DROP TABLE t1, t2;
297267
CREATE TABLE t1 (
298268
id int(11) NOT NULL AUTO_INCREMENT,
299-
year year(2) DEFAULT NULL,
269+
year year(4) DEFAULT NULL,
300270
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
301271
PRIMARY KEY (id)
302272
) ENGINE=InnoDB
303273
PARTITION BY HASH (id)
304274
PARTITIONS 2;
305-
Warnings:
306-
Level Warning
307-
Code 1818
308-
Message YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
309275
CREATE TABLE t2 (
310276
id int(11) NOT NULL AUTO_INCREMENT,
311-
year year(2) DEFAULT NULL,
277+
year year(4) DEFAULT NULL,
312278
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
313279
PRIMARY KEY (id)
314280
) ENGINE=InnoDB ROW_FORMAT = REDUNDANT;
315-
Warnings:
316-
Level Warning
317-
Code 1818
318-
Message YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
319281
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
320282
ERROR HY000: Non matching attribute 'ROW_FORMAT' between partition and table
321283
SHOW CREATE TABLE t1;
@@ -353,26 +315,18 @@ CREATE_OPTIONS row_format=REDUNDANT
353315
DROP TABLE t1, t2;
354316
CREATE TABLE t1 (
355317
id int(11) NOT NULL AUTO_INCREMENT,
356-
year year(2) DEFAULT NULL,
318+
year year(4) DEFAULT NULL,
357319
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
358320
PRIMARY KEY (id)
359321
) ENGINE=InnoDB ROW_FORMAT = COMPACT
360322
PARTITION BY HASH (id)
361323
PARTITIONS 2;
362-
Warnings:
363-
Level Warning
364-
Code 1818
365-
Message YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
366324
CREATE TABLE t2 (
367325
id int(11) NOT NULL AUTO_INCREMENT,
368-
year year(2) DEFAULT NULL,
326+
year year(4) DEFAULT NULL,
369327
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
370328
PRIMARY KEY (id)
371329
) ENGINE=InnoDB ROW_FORMAT = REDUNDANT;
372-
Warnings:
373-
Level Warning
374-
Code 1818
375-
Message YEAR(2) column type is deprecated. Creating YEAR(4) column instead.
376330
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
377331
ERROR HY000: Non matching attribute 'ROW_FORMAT' between partition and table
378332
SHOW CREATE TABLE t1;

0 commit comments

Comments
 (0)