Bug #24 field created from subselect has incorrect attributes

Submitted: 6 Jan 2003 11:58 Modified: 29 Jan 2003 18:43
Reporter: Oleksandr Byelkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:Any (any)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[6 Jan 2003 11:58] Oleksandr Byelkin
Description:
incorrect attributes of subselect item? 

How to repeat:
CREATE TABLE s SELECT * FROM (SELECT 1 as a,(SELECT 1)) a; 
 
mysql> SHOW CREATE TABLE s; 
+-------+------------------------------------------------------------------- 
----------------------------------------------------------+ 
| Table | Create Table 
| 
+-------+------------------------------------------------------------------- 
----------------------------------------------------------+ 
| s     | CREATE TABLE `s` ( 
  `a` bigint(1) NOT NULL default '0', 
  `(SELECT 1)` bigint(1) default NULL 
) TYPE=MyISAM CHARSET=latin1 | 
+-------+------------------------------------------------------------------- 
----------------------------------------------------------+ 
1 row in set (0.00 sec) 
 
Why does the second field is defined as default NULL ? 
 
CREATE TABLE s SELECT * FROM (SELECT 1 as a,(SELECT a)) a; 
 
mysql> SHOW CREATE TABLE s; 
+-------+------------------------------------------------------------------- 
----------------------------------------------------------+ 
| Table | Create Table 
| 
+-------+------------------------------------------------------------------- 
----------------------------------------------------------+ 
| s     | CREATE TABLE `s` ( 
  `a` bigint(1) NOT NULL default '0', 
  `(SELECT a)` bigint(0) default NULL 
) TYPE=MyISAM CHARSET=latin1 | 
+-------+------------------------------------------------------------------- 
----------------------------------------------------------+ 
1 row in set (0.00 sec) 
 
Why in this case a bigint(0) (??) with default NULL 
 
CREATE TABLE s SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a; 
 
mysql> SHOW CREATE TABLE s; 
+-------+------------------------------------------------------------------- 
-------------------------------------------------------------+ 
| Table | Create Table 
| 
+-------+------------------------------------------------------------------- 
-------------------------------------------------------------+ 
| s     | CREATE TABLE `s` ( 
  `a` bigint(1) NOT NULL default '0', 
  `(SELECT a+0)` bigint(17) default NULL 
) TYPE=MyISAM CHARSET=latin1 | 
+-------+------------------------------------------------------------------- 
-------------------------------------------------------------+ 
1 row in set (0.00 sec) 

Suggested fix:
none

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.047 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.