Bug #47693 | VIEW with GROUP BY and WITH ROLLUP causes "Column can not be null" error. | ||
---|---|---|---|
Submitted: | 28 Sep 2009 22:38 | Modified: | 6 Mar 2018 17:25 |
Reporter: | Jon Armstrong | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Views | Severity: | S3 (Non-critical) |
Version: | 5.5.45 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | aggregation, VIEW, with rollup |
[28 Sep 2009 22:38]
Jon Armstrong
[28 Sep 2009 22:40]
Jon Armstrong
Correction: The initial /* ... comment ... was intended to be within the MySQL input, not input to the shell */ Sorry about that.
[28 Sep 2009 23:54]
MySQL Verification Team
Thank you for the bug report. Verified as described. mysql 5.1 >SELECT * FROM v_view_test; ERROR 1048 (23000): Column 'pk' cannot be null mysql 5.1 > mysql 5.1 >select version(); +----------------+ | version() | +----------------+ | 5.1.39-Win X64 | +----------------+ 1 row in set (0.00 sec)
[13 Oct 2010 19:56]
Ravishankar Narayana
This is still happening even as recently as 5.1.49. This specifically happens only when the select joins 2 or more table and then uses a group by with a rollup . The view creation itself is successful, But an attempt to write a select query on the view will fail. The error displayed is ERROR 1356 (HY000): View 'XXXX' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
[10 Mar 2015 15:45]
Erlend Dahl
No longer repeatable in 5.6.
[19 Jun 2015 8:13]
Jon Armstrong
The original behavior is gone, but is now replaced with another bug. The expected NULL in the rollup row is now replaced by 0 for the given test-case. That's incorrect behavior. According to the 5.7 documentation, NULL is still the expected value to be generated for the grouped column in the final row of the test-case. Tested in 5.7.5-m15
[19 Jun 2015 10:38]
Roy Lyseng
Reopened based on returning wrong data.
[6 Mar 2018 17:25]
Paul DuBois
Posted by developer: Fixed in 8.0.4. Selecting from a view that involved aggregation and WITH ROLLUP could result in a spurious "Column col_name cannot be null" error.