[MDEV-8927] CONNECT does not return the correct row count for "select count(*) from" for OCCUR type table Created: 2015-10-09 Updated: 2015-10-23 Resolved: 2015-10-20 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Connect |
| Affects Version/s: | 10.0.15, 10.0.21, 10.0, 10.1 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Tuco | Assignee: | Olivier Bertrand |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | wrong_result | ||
| Environment: |
Windows Server 2008 R2; Windows 7 |
||
| Description |
|
CONNECT does not return the correct total row count for "select count(*) from " query against OCCUR type table. It instead returns the total number of rows of the base(source) table.
|
| Comments |
| Comment by Olivier Bertrand [ 2015-10-20 ] | |||||||
|
OCCURS tables, as well as XCOL tables, make some row multiplication depending on the query. Row multiplication occurs only when a specific "multiple" column is used in the query (XCOL or OCCURCOL) This is more clearly explained for XCOL tables, the documentation saying in particular: If a query does not involve the “multiple” column, no row multiplication will be done. For instance:
The documentation of OCCURS table has just a note saying: Note 1: Like for XCOL tables, no row multiplication for queries not implying the Occur column. It is also possible to use the ROWNUM special column with similar result. In your example, the queries:
all return 6 except the last one that return 9 because it includes explicitely the "multiple" column. Keep in mind that these tables do not have a proper "count" value as they can return different number of rows even without where clause ot limit value. However, I admit that the documentation should be more explicite. | |||||||
| Comment by Tuco [ 2015-10-20 ] | |||||||
|
Thank you, I should've read the documentation more closely. BTW. I really love CONNECT. It is amazingly useful. Thank you for all your hard work. | |||||||
| Comment by Olivier Bertrand [ 2015-10-21 ] | |||||||
|
I have been thinking about that. Indeed in queries such as:
the star means "all columns". However this may not be the case for "count | |||||||
| Comment by Tuco [ 2015-10-23 ] | |||||||
|
I understand. Thank you. |