Commit 154ffb3f authored by unknown's avatar unknown

bug#21072 Duplicate key error in NDB references wrong key: Post-merge fixes

parent f0e3f8f1
......@@ -112,9 +112,9 @@ unique key(a)
) engine=ndb;
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
ERROR 23000: Duplicate entry 'aaa' for key 'a'
insert into t1 values(3, 'AAA');
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
ERROR 23000: Duplicate entry 'AAA' for key 'a'
select * from t1 order by p;
p a
1 aAa
......@@ -138,9 +138,9 @@ unique key(a)
) engine=ndb;
insert into t1 values (1,'A'),(2,'b '),(3,'C '),(4,'d '),(5,'E'),(6,'f');
insert into t1 values(99,'b');
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
ERROR 23000: Duplicate entry 'b' for key 'a'
insert into t1 values(99,'a ');
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
ERROR 23000: Duplicate entry 'a ' for key 'a'
select a,length(a) from t1 order by a;
a length(a)
A 1
......
......@@ -22,7 +22,7 @@ select * from t1 where b = 4 order by a;
a b c
3 4 6
insert into t1 values(8, 2, 3);
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
ERROR 23000: Duplicate entry '2' for key 'ib'
select * from t1 order by a;
a b c
1 2 3
......@@ -93,7 +93,7 @@ a b c
1 1 1
4 4 NULL
insert into t1 values(5,1,1);
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
ERROR 23000: Duplicate entry '1-1' for key 'bc'
drop table t1;
CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
......@@ -116,7 +116,7 @@ select * from t2 where b = 4 order by a;
a b c
3 4 6
insert into t2 values(8, 2, 3);
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
ERROR 23000: Duplicate entry '2-3' for key 'b'
select * from t2 order by a;
a b c
1 2 3
......@@ -139,7 +139,7 @@ a b c
8 2 3
create unique index bi using hash on t2(b);
insert into t2 values(9, 3, 1);
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
ERROR 23000: Duplicate entry '3' for key 'bi'
alter table t2 drop index bi;
insert into t2 values(9, 3, 1);
select * from t2 order by a;
......@@ -229,7 +229,7 @@ pk a
3 NULL
4 4
insert into t1 values (5,0);
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
ERROR 23000: Duplicate entry '0' for key 'a'
select * from t1 order by pk;
pk a
-1 NULL
......@@ -262,7 +262,7 @@ pk a b c
0 NULL 18 NULL
1 3 19 abc
insert into t2 values(2,3,19,'abc');
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
ERROR 23000: Duplicate entry '3-abc' for key 'si'
select * from t2 order by pk;
pk a b c
-1 1 17 NULL
......@@ -682,7 +682,7 @@ create table t1 (a int primary key, b varchar(1000) not null, unique key (b))
engine=ndb charset=utf8;
insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200));
insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200));
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
ERROR 23000: Duplicate entry '∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫d' for key 'b'
select a, sha1(b) from t1;
a sha1(b)
1 08f5d02c8b8bc244f275bdfc22c42c5cab0d9d7d
......
......@@ -28,7 +28,7 @@ pk1 b c
2 2 2
4 1 1
UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4;
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
ERROR 23000: Duplicate entry '2' for key 'c'
UPDATE IGNORE t1 set pk1 = 1, c = 2 where pk1 = 4;
select * from t1 order by pk1;
pk1 b c
......@@ -62,9 +62,9 @@ INSERT INTO t3 VALUES (2, 2);
UPDATE t1 SET a = 1;
UPDATE t1 SET a = 1 ORDER BY a;
UPDATE t2 SET a = 1;
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
ERROR 23000: Duplicate entry '1-2' for key 'a'
UPDATE t2 SET a = 1 ORDER BY a;
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
ERROR 23000: Duplicate entry '1-2' for key 'a'
UPDATE t3 SET a = 1;
ERROR 23000: Duplicate entry '1-2' for key 'PRIMARY'
UPDATE t3 SET a = 1 ORDER BY a;
......
......@@ -599,7 +599,6 @@ int ha_ndbcluster::ndb_err(NdbTransaction *trans)
const NDBINDEX *unique_index=
(const NDBINDEX *) m_index[i].unique_index;
if (unique_index &&
unique_index->getIndexTable() &&
(uint) unique_index->getObjectId() == error_data)
{
dupkey= i;
......
......@@ -1021,11 +1021,6 @@ public:
*/
const char * getTable() const;
/**
* Get the table representing the index
*/
const Table * getIndexTable() const;
/**
* Get the number of columns in the index
*/
......
......@@ -792,15 +792,6 @@ NdbDictionary::Index::getTable() const {
return m_impl.getTable();
}
const NdbDictionary::Table *
NdbDictionary::Index::getIndexTable() const {
NdbTableImpl * t = m_impl.m_table;
if (t) {
return t->m_facade;
}
return 0;
}
unsigned
NdbDictionary::Index::getNoOfColumns() const {
return m_impl.m_columns.size();
......
......@@ -549,7 +549,7 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal)
if (aSignal->getLength() == TcKeyRef::SignalLength)
{
// Signal may contain additional error data
setErrorDetails((char *) aSignal->readData(5));
theError.details = (char *) aSignal->readData(5);
}
theStatus = Finished;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment