Bug #11995 VIEW redefines int(n) definition to int(11)
Submitted: 18 Jul 2005 5:15 Modified: 19 Jul 2005 15:35
Reporter: Richard Fyffe Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:5.0.9-beta-nt OS:Windows (Windows XP)
Assigned to: Assigned Account CPU Architecture:Any

[18 Jul 2005 5:15] Richard Fyffe
Description:

When creating a view from table columns defined as int(1), int(2), .... etc, the view alwaws has the definition of int(11).

Very similar problem to bug 11335 where the view definition of tinyint was always defaulting to tinyint(4), so may have been fixed at the same time.

http://bugs.mysql.com/bug.php?id=11335

How to repeat:
mysql> create table test (val1 int(1), val2 int(2), val3 int(3));
Query OK, 0 rows affected (1.78 sec)

mysql> describe test;
+-------+--------+------+-----+---------+-------+
| Field | Type   | Null | Key | Default | Extra |
+-------+--------+------+-----+---------+-------+
| val1  | int(1) | YES  |     | NULL    |       |
| val2  | int(2) | YES  |     | NULL    |       |
| val3  | int(3) | YES  |     | NULL    |       |
+-------+--------+------+-----+---------+-------+
3 rows in set (0.79 sec)

mysql> create view test_v as select * from test;
Query OK, 0 rows affected (0.17 sec)

mysql> describe test_v;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| val1  | int(11) | YES  |     | NULL    |       |
| val2  | int(11) | YES  |     | NULL    |       |
| val3  | int(11) | YES  |     | NULL    |       |
+-------+---------+------+-----+---------+-------+
3 rows in set (0.17 sec)
[18 Jul 2005 9:58] Vasily Kishkin
Tested on Win 2003 , MySQL server 5.0.9
[19 Jul 2005 15:35] Evgeny Potemkin
Duplicate of bug #11335