Bug #74218 Missing table name in error message 1022
Submitted: 3 Oct 2014 23:02 Modified: 29 Oct 2019 15:02
Reporter: Slava C Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:5.6.19-ndb-7.3.6 OS:Any
Assigned to: CPU Architecture:Any

[3 Oct 2014 23:02] Slava C
Description:
Error message about duplicate value in unique index caused by "update" is missing table name sometimes:
ERROR 1022 (23000): Can't write; duplicate key in table ''

> show warnings;
Warning │ 1296 │ Got error 893 'Constraint violation e.g. duplicate value in unique index' from NDB
Error   │ 1022 │ Can't write; duplicate key in table ''
Error   │ 1180 │ Got error 121 during COMMIT

How to repeat:
drop table if exists foo;
create table foo(
  id integer primary key,
  value int,
  unique key(value)
) engine=ndbcluster;

insert foo set id=1, value=1;
insert foo set id=2, value=2;
update foo set value=2 where value=1;
[5 Oct 2014 6:08] MySQL Verification Team
Hello Slava C,

Thank you for the bug report and test case.

Thanks,
Umesh
[5 Oct 2014 6:10] MySQL Verification Team
//
mysql> show variables like '%version%';
+-------------------------+------------------------------------------------------+
| Variable_name           | Value                                                |
+-------------------------+------------------------------------------------------+
| innodb_version          | 5.6.19                                               |
| ndb_version             | 459526                                               |
| ndb_version_string      | ndb-7.3.6                                            |
| ndbinfo_version         | 459526                                               |
| protocol_version        | 10                                                   |
| slave_type_conversions  |                                                      |
| version                 | 5.6.19-ndb-7.3.6-cluster-commercial-advanced-log     |
| version_comment         | MySQL Cluster Server - Advanced Edition (Commercial) |
| version_compile_machine | x86_64                                               |
| version_compile_os      | linux-glibc2.5                                       |
+-------------------------+------------------------------------------------------+
10 rows in set (0.00 sec)

mysql> drop table if exists foo;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> create table foo(
    ->   id integer primary key,
    ->   value int,
    ->   unique key(value)
    -> ) engine=ndbcluster;
Query OK, 0 rows affected (1.89 sec)

mysql> insert foo set id=1, value=1;
Query OK, 1 row affected (0.02 sec)

mysql> insert foo set id=2, value=2;
Query OK, 1 row affected (0.00 sec)

mysql> update foo set value=2 where value=1;
ERROR 1022 (23000): Can't write; duplicate key in table '' <------ Can't write; duplicate key in table '%s'
[29 Oct 2019 15:02] Jon Stephens
Documented fix in the NDB 8.0.19 changelog as follows:

    When returning Error 1022, NDB did not print the 
    name of the affected table.

Closed.