Commit 84aec2fa authored by magnus@neptunus.(none)'s avatar magnus@neptunus.(none)

Merge msvensson@build.mysql.com:/home/bk/mysql-4.1

into neptunus.(none):/home/magnus/mysql/mysql-4.1
parents 2c86049d 8788f96e
...@@ -416,4 +416,16 @@ INSERT INTO t1 VALUES ...@@ -416,4 +416,16 @@ INSERT INTO t1 VALUES
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
COUNT(*) COUNT(*)
2000 2000
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
ERROR 23000: Duplicate entry '10' for key 1
begin;
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
ERROR 23000: Duplicate entry '10' for key 1
commit;
insert into t1 select * from t1 where b < 10 order by pk1;
ERROR 23000: Duplicate entry '9' for key 1
DROP TABLE t1; DROP TABLE t1;
...@@ -429,5 +429,34 @@ INSERT INTO t1 VALUES ...@@ -429,5 +429,34 @@ INSERT INTO t1 VALUES
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
#
# Insert duplicate rows
#
--error 1062
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
begin;
#
# Insert duplicate rows, inside transaction
#
--error 1062
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
commit;
#
# Insert duplicate rows using "insert .. select"
#
--error 1062
insert into t1 select * from t1 where b < 10 order by pk1;
DROP TABLE t1; DROP TABLE t1;
...@@ -1111,12 +1111,12 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op, ...@@ -1111,12 +1111,12 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
const char* bounds[]= {"LE", "LT", "GE", "GT", "EQ"}; const char* bounds[]= {"LE", "LT", "GE", "GT", "EQ"};
DBUG_ASSERT(bound >= 0 && bound <= 4); DBUG_ASSERT(bound >= 0 && bound <= 4);
DBUG_PRINT("info", ("Set Bound%s on %s %s %s %s", DBUG_PRINT("info", ("Set Bound%s on %s %s %s",
bounds[bound], bounds[bound],
field->field_name, field->field_name,
key_nullable ? "NULLABLE" : "", key_nullable ? "NULLABLE" : "",
key_null ? "NULL":"")); key_null ? "NULL":""));
DBUG_PRINT("info", ("Total length %ds", tot_len)); DBUG_PRINT("info", ("Total length %d", tot_len));
DBUG_DUMP("key", (char*) key_ptr, key_store_len); DBUG_DUMP("key", (char*) key_ptr, key_store_len);
...@@ -1143,6 +1143,44 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op, ...@@ -1143,6 +1143,44 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
DBUG_RETURN(0); DBUG_RETURN(0);
} }
#ifndef DBUG_OFF
const char* key_flag_strs[] =
{ "HA_READ_KEY_EXACT",
"HA_READ_KEY_OR_NEXT",
"HA_READ_KEY_OR_PREV",
"HA_READ_AFTER_KEY",
"HA_READ_BEFORE_KEY",
"HA_READ_PREFIX",
"HA_READ_PREFIX_LAST",
"HA_READ_PREFIX_LAST_OR_PREV",
"HA_READ_MBR_CONTAIN",
"HA_READ_MBR_INTERSECT",
"HA_READ_MBR_WITHIN",
"HA_READ_MBR_DISJOINT",
"HA_READ_MBR_EQUAL"
};
const int no_of_key_flags = sizeof(key_flag_strs)/sizeof(char*);
void print_key(const key_range* key, const char* info)
{
if (key)
{
const char* str= key->flag < no_of_key_flags ?
key_flag_strs[key->flag] : "Unknown flag";
DBUG_LOCK_FILE;
fprintf(DBUG_FILE,"%s: %s, length=%d, key=", info, str, key->length);
uint i;
for (i=0; i<key->length-1; i++)
fprintf(DBUG_FILE,"%0d ", key->key[i]);
fprintf(DBUG_FILE, "\n");
DBUG_UNLOCK_FILE;
}
return;
}
#endif
/* /*
Start ordered index scan in NDB Start ordered index scan in NDB
...@@ -1160,6 +1198,9 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key, ...@@ -1160,6 +1198,9 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
DBUG_ENTER("ordered_index_scan"); DBUG_ENTER("ordered_index_scan");
DBUG_PRINT("enter", ("index: %u, sorted: %d", active_index, sorted)); DBUG_PRINT("enter", ("index: %u, sorted: %d", active_index, sorted));
DBUG_PRINT("enter", ("Starting new ordered scan on %s", m_tabname)); DBUG_PRINT("enter", ("Starting new ordered scan on %s", m_tabname));
DBUG_EXECUTE("enter", print_key(start_key, "start_key"););
DBUG_EXECUTE("enter", print_key(end_key, "end_key"););
index_name= get_index_name(active_index); index_name= get_index_name(active_index);
if (!(op= trans->getNdbIndexScanOperation((NDBINDEX *) if (!(op= trans->getNdbIndexScanOperation((NDBINDEX *)
...@@ -2360,7 +2401,7 @@ int ha_ndbcluster::end_bulk_insert() ...@@ -2360,7 +2401,7 @@ int ha_ndbcluster::end_bulk_insert()
rows_inserted, bulk_insert_rows)); rows_inserted, bulk_insert_rows));
bulk_insert_not_flushed= false; bulk_insert_not_flushed= false;
if (trans->execute(NoCommit) != 0) if (trans->execute(NoCommit) != 0)
error= ndb_err(trans); my_errno= error= ndb_err(trans);
} }
rows_inserted= 0; rows_inserted= 0;
......
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