[MDEV-30347] Seemingly different result upon aggregate function on BIT column directly vs subquery Created: 2023-01-05  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: None


 Description   

CREATE TABLE t (b BIT);
INSERT INTO t VALUES (0);
 
SELECT MIN(b) AS f FROM t;
SELECT f FROM (SELECT MIN(b) AS f FROM t) sq;
 
# Cleanup
DROP TABLE t;

10.3 0ca3aaa7

MariaDB [test]> SELECT MIN(b) AS f FROM t;
+------+
| f    |
+------+
| 0    |
+------+
1 row in set (0.001 sec)
 
MariaDB [test]> SELECT f FROM (SELECT MIN(b) AS f FROM t) sq;
+------+
| f    |
+------+
|      |
+------+
1 row in set (0.001 sec)

With column type info:

MariaDB [test]> SELECT MIN(b) AS f FROM t;
Field   1:  `f`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       BIT
Collation:  binary (63)
Length:     1
Max_length: 1
Decimals:   0
Flags:      UNSIGNED BINARY 
 
 
+------+
| f    |
+------+
| 0    |
+------+
1 row in set (0.001 sec)
 
MariaDB [test]> SELECT f FROM (SELECT MIN(b) AS f FROM t) sq;
Field   1:  `f`
Catalog:    `def`
Database:   ``
Table:      `sq`
Org_table:  `t`
Type:       BIT
Collation:  binary (63)
Length:     1
Max_length: 1
Decimals:   0
Flags:      UNSIGNED 


Generated at Thu Feb 08 10:15:34 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.