Bug #12885 | rollup / subquery and creat table, causes incorrect cannot be null | ||
---|---|---|---|
Submitted: | 30 Aug 2005 16:05 | Modified: | 15 Sep 2005 19:12 |
Reporter: | Martin Friebe (Gold Quality Contributor) (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 4.1.14, 5.0.11 | OS: | FreeBSD (freebsd, Windows) |
Assigned to: | Igor Babaev | CPU Architecture: | Any |
[30 Aug 2005 16:05]
Martin Friebe
[31 Aug 2005 8:40]
Valeriy Kravchuk
Yes, the same bug with views in 5.0.11: mysql> use test; Database changed mysql> create table t1 (a varchar(9) not null default ''); Query OK, 0 rows affected (0.18 sec) mysql> insert into t1 values ('a'); Query OK, 1 row affected (0.05 sec) mysql> select a, length(a),count(*) from t1 group by a with rollup; +---+-----------+----------+ | a | length(a) | count(*) | +---+-----------+----------+ | a | 1 | 1 | | NULL| NULL | 1 | +---+-----------+----------+ 2 rows in set (0.04 sec) mysql> create view v1 as select a, length(a),count(*) from t1 group by a with rollup; Query OK, 0 rows affected (0.00 sec) mysql> desc v1; +-----------+------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+------------+------+-----+---------+-------+ | a | varchar(9) | YES | | NULL | | | length(a) | bigint(10) | NO | | 0 | | | count(*) | bigint(21) | NO | | 0 | | +-----------+------------+------+-----+---------+-------+ 3 rows in set (0.16 sec) mysql> select * from v1; ERROR 1048 (23000): Column 'length(a)' cannot be null mysql> select version(); +----------------+ | version() | +----------------+ | 5.0.11-beta-nt | +----------------+ 1 row in set (0.00 sec)
[8 Sep 2005 19:37]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/internals/29525
[8 Sep 2005 22:45]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/internals/29535
[8 Sep 2005 23:14]
Igor Babaev
ChangeSet 1.2414 05/09/08 12:37:16 igor@rurik.mysql.com +3 -0 sql_select.cc: Fixed bug #12885. Forced inheritence of the maybe_null flag for the expressions containing GROUP BY attributes in selects with ROLLUP. olap.test, olap.result: Added test case for bug #12885. The fix was merged into 5.0 and a test cases with VIEW was added. This fix will appear in 4.1.15 and 5.0.13
[15 Sep 2005 19:12]
Paul DuBois
Noted in 4.1.15, 5.0.13 changelogs.