1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/home/my/mysql-4.1
This commit is contained in:
monty@mysql.com
2004-09-01 02:13:35 +03:00
35 changed files with 229 additions and 1090 deletions

View File

@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
AM_INIT_AUTOMAKE(mysql, 4.1.4-gamma)
AM_INIT_AUTOMAKE(mysql, 4.1.5-gamma)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10

File diff suppressed because it is too large Load Diff

View File

@ -212,3 +212,48 @@ select count(*) from t1 where b = 1;
count(*)
1
drop table t1;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned,
c int unsigned,
KEY bc(b,c)
) engine = ndb;
insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
select * from t1 use index (bc) where b IS NULL;
a b c
3 NULL NULL
2 NULL 2
select * from t1 use index (bc)order by a;
a b c
1 1 1
2 NULL 2
3 NULL NULL
4 4 NULL
select * from t1 use index (bc) order by a;
a b c
1 1 1
2 NULL 2
3 NULL NULL
4 4 NULL
select * from t1 use index (PRIMARY) where b IS NULL order by a;
a b c
2 NULL 2
3 NULL NULL
select * from t1 use index (bc) where b IS NULL order by a;
a b c
2 NULL 2
3 NULL NULL
select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
a b c
3 NULL NULL
select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
a b c
2 NULL 2
select * from t1 use index (bc) where b < 4 order by a;
a b c
1 1 1
select * from t1 use index (bc) where b IS NOT NULL order by a;
a b c
1 1 1
4 4 NULL
drop table t1;

View File

@ -109,6 +109,68 @@ a b c
3 4 6
drop table t3;
CREATE TABLE t1 (
pk int NOT NULL PRIMARY KEY,
a int unsigned,
UNIQUE KEY (a)
) engine=ndbcluster;
insert into t1 values (-1,NULL), (0,0), (1,NULL),(2,2),(3,NULL),(4,4);
select * from t1 order by pk;
pk a
-1 NULL
0 0
1 NULL
2 2
3 NULL
4 4
insert into t1 values (5,0);
ERROR 23000: Can't write, because of unique constraint, to table 't1'
select * from t1 order by pk;
pk a
-1 NULL
0 0
1 NULL
2 2
3 NULL
4 4
delete from t1 where a = 0;
insert into t1 values (5,0);
select * from t1 order by pk;
pk a
-1 NULL
1 NULL
2 2
3 NULL
4 4
5 0
CREATE TABLE t2 (
pk int NOT NULL PRIMARY KEY,
a int unsigned,
b tinyint NOT NULL,
c VARCHAR(10),
UNIQUE KEY si(a, c)
) engine=ndbcluster;
insert into t2 values (-1,1,17,NULL),(0,NULL,18,NULL),(1,3,19,'abc');
select * from t2 order by pk;
pk a b c
-1 1 17 NULL
0 NULL 18 NULL
1 3 19 abc
insert into t2 values(2,3,19,'abc');
ERROR 23000: Can't write, because of unique constraint, to table 't2'
select * from t2 order by pk;
pk a b c
-1 1 17 NULL
0 NULL 18 NULL
1 3 19 abc
delete from t2 where c IS NOT NULL;
insert into t2 values(2,3,19,'abc');
select * from t2 order by pk;
pk a b c
-1 1 17 NULL
0 NULL 18 NULL
2 3 19 abc
drop table t1, t2;
CREATE TABLE t1 (
cid smallint(5) unsigned NOT NULL default '0',
cv varchar(250) NOT NULL default '',
PRIMARY KEY (cid),

View File

@ -11,7 +11,7 @@ insert into t1 (gesuchnr, benutzer_id) value (3,2);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
insert into t1 (gesuchnr,benutzer_id) values (1,1);
ERROR 23000: Can't write; duplicate key in table 't1'
ERROR 23000: Duplicate entry '1-1' for key 1
replace into t1 (gesuchnr,benutzer_id) values (1,1);
select * from t1 order by gesuchnr;
gesuchnr benutzer_id

View File

@ -206,10 +206,6 @@ select * from t4 where a = 7 and b = 16 order by a;
select * from t4 where a = 7 and b = 17 order by a;
select * from t4 where a = 7 and b != 16 order by b;
select x1.a, x1.b from t2 x1, t2 x2 where x1.b = x2.b order by x1.a;
select a, b FROM t2 outer_table where
a = (select a from t2 where b = outer_table.b ) order by a;
#
# update records
#
@ -225,6 +221,12 @@ while ($1)
}
enable_query_log;
delete from t2 where a > 5;
select x1.a, x1.b from t2 x1, t2 x2 where x1.b = x2.b order by x1.a;
select a, b FROM t2 outer_table where
a = (select a from t2 where b = outer_table.b ) order by a;
delete from t2;
delete from t3;
delete from t4;

View File

@ -122,18 +122,22 @@ drop table t1;
# Indexing NULL values
#
#CREATE TABLE t1 (
# a int unsigned NOT NULL PRIMARY KEY,
# b int unsigned,
# c int unsigned,
# KEY bc(b,c)
#) engine = ndb;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned,
c int unsigned,
KEY bc(b,c)
) engine = ndb;
#insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
#select * from t1 use index (bc);
#select count(*) from t1 use index (bc);
#select count(*) from t1 use index (PRIMARY) where b IS NULL;
#select count(*) from t1 use index (bc) where b IS NULL;
#select count(*) from t1 use index (bc) where b IS NULL and c = 2;
#select count(*) from t1 use index (bc) where b IS NOT NULL;
#drop table t1;
insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
select * from t1 use index (bc) where b IS NULL;
select * from t1 use index (bc)order by a;
select * from t1 use index (bc) order by a;
select * from t1 use index (PRIMARY) where b IS NULL order by a;
select * from t1 use index (bc) where b IS NULL order by a;
select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
select * from t1 use index (bc) where b < 4 order by a;
select * from t1 use index (bc) where b IS NOT NULL order by a;
drop table t1;

View File

@ -82,43 +82,43 @@ drop table t3;
# Indexes on NULL-able columns
#
#CREATE TABLE t1 (
# pk int NOT NULL PRIMARY KEY,
# a int unsigned,
# UNIQUE KEY (a)
#) engine=ndbcluster;
CREATE TABLE t1 (
pk int NOT NULL PRIMARY KEY,
a int unsigned,
UNIQUE KEY (a)
) engine=ndbcluster;
#insert into t1 values (-1,NULL), (0,0), (1,NULL),(2,2),(3,NULL),(4,4);
insert into t1 values (-1,NULL), (0,0), (1,NULL),(2,2),(3,NULL),(4,4);
#select * from t1 order by pk;
select * from t1 order by pk;
#--error 1169
#insert into t1 values (5,0);
#select * from t1 order by pk;
#delete from t1 where a = 0;
#insert into t1 values (5,0);
#select * from t1 order by pk;
--error 1169
insert into t1 values (5,0);
select * from t1 order by pk;
delete from t1 where a = 0;
insert into t1 values (5,0);
select * from t1 order by pk;
#CREATE TABLE t2 (
# pk int NOT NULL PRIMARY KEY,
# a int unsigned,
# b tinyint NOT NULL,
# c VARCHAR(10),
# UNIQUE KEY si(a, c)
#) engine=ndbcluster;
CREATE TABLE t2 (
pk int NOT NULL PRIMARY KEY,
a int unsigned,
b tinyint NOT NULL,
c VARCHAR(10),
UNIQUE KEY si(a, c)
) engine=ndbcluster;
#insert into t2 values (-1,1,17,NULL),(0,NULL,18,NULL),(1,3,19,'abc');
insert into t2 values (-1,1,17,NULL),(0,NULL,18,NULL),(1,3,19,'abc');
#select * from t2 order by pk;
select * from t2 order by pk;
#--error 1169
#insert into t2 values(2,3,19,'abc');
#select * from t2 order by pk;
#delete from t2 where c IS NOT NULL;
#insert into t2 values(2,3,19,'abc');
#select * from t2 order by pk;
--error 1169
insert into t2 values(2,3,19,'abc');
select * from t2 order by pk;
delete from t2 where c IS NOT NULL;
insert into t2 values(2,3,19,'abc');
select * from t2 order by pk;
#drop table t1, t2;
drop table t1, t2;
#
# More complex tables

View File

@ -20,7 +20,7 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1);
insert into t1 (gesuchnr, benutzer_id) value (3,2);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
--error 1022
--error 1062
insert into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
select * from t1 order by gesuchnr;

View File

@ -144,6 +144,7 @@ static int ndb_to_mysql_error(const NdbError *err)
int ha_ndbcluster::ndb_err(NdbConnection *trans)
{
int res;
const NdbError err= trans->getNdbError();
if (!err.code)
return 0; // Don't log things to DBUG log if no error
@ -161,7 +162,13 @@ int ha_ndbcluster::ndb_err(NdbConnection *trans)
default:
break;
}
DBUG_RETURN(ndb_to_mysql_error(&err));
res= ndb_to_mysql_error(&err);
DBUG_PRINT("info", ("transformed ndbcluster error %d to mysql error %d",
err.code, res));
if (res == HA_ERR_FOUND_DUPP_KEY)
dupkey= table->primary_key;
DBUG_RETURN(res);
}
@ -1075,11 +1082,13 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
const key_range *key,
int bound)
{
uint i, tot_len;
uint key_len, key_store_len, tot_len, key_tot_len;
byte *key_ptr;
KEY* key_info= table->key_info + active_index;
KEY_PART_INFO* key_part= key_info->key_part;
KEY_PART_INFO* end= key_part+key_info->key_parts;
Field* field;
bool key_nullable, key_null;
DBUG_ENTER("set_bounds");
DBUG_PRINT("enter", ("bound: %d", bound));
@ -1089,29 +1098,37 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
// Set bounds using key data
tot_len= 0;
key_ptr= (byte *) key->key;
key_ptr= (byte *) key->key;
key_tot_len= key->length;
for (; key_part != end; key_part++)
{
Field* field= key_part->field;
uint32 field_len= field->pack_length();
tot_len+= field_len;
field= key_part->field;
key_len= key_part->length;
key_store_len= key_part->store_length;
key_nullable= (bool) key_part->null_bit;
key_null= (field->maybe_null() && *key_ptr);
tot_len+= key_store_len;
const char* bounds[]= {"LE", "LT", "GE", "GT", "EQ"};
DBUG_ASSERT(bound >= 0 && bound <= 4);
DBUG_PRINT("info", ("Set Bound%s on %s",
DBUG_PRINT("info", ("Set Bound%s on %s %s %s %s",
bounds[bound],
field->field_name));
DBUG_DUMP("key", (char*)key_ptr, field_len);
field->field_name,
key_nullable ? "NULLABLE" : "",
key_null ? "NULL":""));
DBUG_PRINT("info", ("Total length %ds", tot_len));
DBUG_DUMP("key", (char*) key_ptr, key_store_len);
if (op->setBound(field->field_name,
bound,
field->is_null() ? 0 : key_ptr,
field->is_null() ? 0 : field_len) != 0)
key_null ? 0 : (key_nullable ? key_ptr + 1 : key_ptr),
key_null ? 0 : key_len) != 0)
ERR_RETURN(op->getNdbError());
key_ptr+= field_len;
if (tot_len >= key->length)
key_ptr+= key_store_len;
if (tot_len >= key_tot_len)
break;
/*
@ -2157,7 +2174,10 @@ void ha_ndbcluster::info(uint flag)
if (flag & HA_STATUS_VARIABLE)
DBUG_PRINT("info", ("HA_STATUS_VARIABLE"));
if (flag & HA_STATUS_ERRKEY)
{
DBUG_PRINT("info", ("HA_STATUS_ERRKEY"));
errkey= dupkey;
}
if (flag & HA_STATUS_AUTO)
DBUG_PRINT("info", ("HA_STATUS_AUTO"));
DBUG_VOID_RETURN;
@ -2611,7 +2631,7 @@ int ndbcluster_commit(THD *thd, void *ndb_transaction)
const NdbOperation *error_op= trans->getNdbErrorOperation();
ERR_PRINT(err);
res= ndb_to_mysql_error(&err);
if (res != -1)
if (res != -1)
ndbcluster_print_error(res, error_op);
}
ndb->closeTransaction(trans);
@ -3104,7 +3124,7 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
m_ndb(NULL),
m_table(NULL),
m_table_flags(HA_REC_NOT_IN_SEQ |
//HA_NULL_IN_KEY |
HA_NULL_IN_KEY |
HA_NOT_EXACT_COUNT |
HA_NO_PREFIX_CHAR_KEYS),
m_use_write(false),
@ -3116,7 +3136,8 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
ops_pending(0),
skip_auto_increment(true),
blobs_buffer(0),
blobs_buffer_size(0)
blobs_buffer_size(0),
dupkey((uint) -1)
{
int i;

View File

@ -237,6 +237,7 @@ class ha_ndbcluster: public handler
// memory for blobs in one tuple
char *blobs_buffer;
uint32 blobs_buffer_size;
uint dupkey;
};
bool ndbcluster_init(void);

View File

@ -314,4 +314,4 @@ character-set=latin2
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -308,4 +308,4 @@ character-set=latin1
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -316,4 +316,4 @@ character-set=latin1
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -305,4 +305,4 @@ character-set=latin1
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -310,4 +310,4 @@ character-set=latin7
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -305,4 +305,4 @@ character-set=latin1
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -317,4 +317,4 @@ character-set=latin1
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -305,4 +305,4 @@ character-set=greek
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -307,4 +307,4 @@ character-set=latin2
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -305,4 +305,4 @@ character-set=latin1
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -307,4 +307,4 @@ character-set=ujis
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -305,4 +305,4 @@ character-set=euckr
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -307,4 +307,4 @@ character-set=latin1
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -307,4 +307,4 @@ character-set=latin1
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -309,4 +309,4 @@ character-set=latin2
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -306,4 +306,4 @@ character-set=latin1
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -309,4 +309,4 @@ character-set=latin2
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -307,4 +307,4 @@ character-set=koi8r
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -311,4 +311,4 @@ character-set=cp1250
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -313,4 +313,4 @@ character-set=latin2
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -307,4 +307,4 @@ character-set=latin1
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -305,4 +305,4 @@ character-set=latin1
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -310,4 +310,4 @@ character-set=koi8u
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s' and '%s'"
"Conflicting declarations: '%s%s' and '%s%s'"

View File

@ -1215,12 +1215,9 @@ default_charset:
cinfo->default_table_charset && $4 &&
!my_charset_same(cinfo->default_table_charset,$4))
{
char cs1[32];
char cs2[32];
my_snprintf(cs1, sizeof(cs1), "CHARACTER SET %s",
cinfo->default_table_charset->csname);
my_snprintf(cs2, sizeof(cs2), "CHARACTER SET %s", $4->csname);
net_printf(YYTHD, ER_CONFLICTING_DECLARATIONS, cs1, cs2);
net_printf(YYTHD, ER_CONFLICTING_DECLARATIONS,
"CHARACTER SET ", cinfo->default_table_charset->csname,
"CHARACTER SET ", $4->csname);
YYABORT;
}
Lex->create_info.default_table_charset= $4;