Bug #6538 Error code returned when select max() on empty table with index
Submitted: 10 Nov 2004 6:36 Modified: 10 Nov 2004 18:07
Reporter: Tomas Ulin Email Updates:
Status: Closed Impact on me:
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S1 (Critical)
Version:4.1.8 bk OS:
Assigned to: Jonas Oreland CPU Architecture:Any

[10 Nov 2004 6:36] Tomas Ulin
mysql> CREATE TABLE t1 (i int, index (i) ) ENGINE=NDB;
Query OK, 0 rows affected (0.07 sec)

mysql> SELECT max(i) FROM t1;
ERROR 1296 (HY000): Got error 1 'Unknown error code' from ndbcluster

It correlates with the use of index and max() on emty table

If a row is inserted, max is ok

How to repeat:
CREATE TABLE t1 (a int primary key) ENGINE=NDB;
SELECT max(a) FROM t1;