merged
This commit is contained in:
commit
ee933cd198
@ -115,7 +115,7 @@ LINK32=xilink6.exe
|
|||||||
# Name "mysqladmin - Win32 classic"
|
# Name "mysqladmin - Win32 classic"
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\mysqladmin.c
|
SOURCE=.\mysqladmin.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Target
|
# End Target
|
||||||
# End Project
|
# End Project
|
||||||
|
@ -69,7 +69,7 @@ static HA_ERRORS ha_errlist[]=
|
|||||||
{
|
{
|
||||||
{ 120,"Didn't find key on read or update" },
|
{ 120,"Didn't find key on read or update" },
|
||||||
{ 121,"Duplicate key on write or update" },
|
{ 121,"Duplicate key on write or update" },
|
||||||
{ 123,"Someone has changed the row since it was read; Update with is recoverable" },
|
{ 123,"Someone has changed the row since it was read (while the table was locked to prevent it)" },
|
||||||
{ 124,"Wrong index given to function" },
|
{ 124,"Wrong index given to function" },
|
||||||
{ 126,"Index file is crashed" },
|
{ 126,"Index file is crashed" },
|
||||||
{ 127,"Record-file is crashed" },
|
{ 127,"Record-file is crashed" },
|
||||||
|
@ -52,6 +52,7 @@ int heap_rfirst(HP_INFO *info, byte *record, int inx)
|
|||||||
my_errno=HA_ERR_END_OF_FILE;
|
my_errno=HA_ERR_END_OF_FILE;
|
||||||
DBUG_RETURN(my_errno);
|
DBUG_RETURN(my_errno);
|
||||||
}
|
}
|
||||||
|
DBUG_ASSERT(0); /* TODO fix it */
|
||||||
info->current_record=0;
|
info->current_record=0;
|
||||||
info->current_hash_ptr=0;
|
info->current_hash_ptr=0;
|
||||||
info->update=HA_STATE_PREV_FOUND;
|
info->update=HA_STATE_PREV_FOUND;
|
||||||
|
@ -63,7 +63,7 @@ typedef struct unicase_info_st
|
|||||||
#define MY_CS_UNICODE 128 /* is a charset is full unicode */
|
#define MY_CS_UNICODE 128 /* is a charset is full unicode */
|
||||||
#define MY_CS_READY 256 /* if a charset is initialized */
|
#define MY_CS_READY 256 /* if a charset is initialized */
|
||||||
#define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/
|
#define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/
|
||||||
|
#define MY_CS_CSSORT 1024 /* if case sensitive sort order */
|
||||||
#define MY_CHARSET_UNDEFINED 0
|
#define MY_CHARSET_UNDEFINED 0
|
||||||
|
|
||||||
|
|
||||||
|
@ -4089,6 +4089,9 @@ lock_print_info(
|
|||||||
(ulong) ut_dulint_get_high(purge_sys->purge_undo_no),
|
(ulong) ut_dulint_get_high(purge_sys->purge_undo_no),
|
||||||
(ulong) ut_dulint_get_low(purge_sys->purge_undo_no));
|
(ulong) ut_dulint_get_low(purge_sys->purge_undo_no));
|
||||||
|
|
||||||
|
fprintf(file,
|
||||||
|
"History list length %lu\n", (ulong) trx_sys->rseg_history_len);
|
||||||
|
|
||||||
fprintf(file,
|
fprintf(file,
|
||||||
"Total number of lock structs in row lock hash table %lu\n",
|
"Total number of lock structs in row lock hash table %lu\n",
|
||||||
(ulong) lock_get_n_rec_locks());
|
(ulong) lock_get_n_rec_locks());
|
||||||
|
@ -638,23 +638,24 @@ row_sel_get_clust_rec(
|
|||||||
if (!node->read_view) {
|
if (!node->read_view) {
|
||||||
/* Try to place a lock on the index record */
|
/* Try to place a lock on the index record */
|
||||||
|
|
||||||
/* If innodb_locks_unsafe_for_binlog option is used,
|
/* If innodb_locks_unsafe_for_binlog option is used,
|
||||||
we lock only the record, i.e. next-key locking is
|
we lock only the record, i.e. next-key locking is
|
||||||
not used.
|
not used.
|
||||||
*/
|
*/
|
||||||
if ( srv_locks_unsafe_for_binlog )
|
|
||||||
{
|
|
||||||
err = lock_clust_rec_read_check_and_lock(0, clust_rec,
|
|
||||||
index,node->row_lock_mode, LOCK_REC_NOT_GAP, thr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
err = lock_clust_rec_read_check_and_lock(0, clust_rec, index,
|
|
||||||
node->row_lock_mode, LOCK_ORDINARY, thr);
|
|
||||||
|
|
||||||
}
|
if (srv_locks_unsafe_for_binlog) {
|
||||||
|
err = lock_clust_rec_read_check_and_lock(0,
|
||||||
|
clust_rec,
|
||||||
|
index, node->row_lock_mode,
|
||||||
|
LOCK_REC_NOT_GAP, thr);
|
||||||
|
} else {
|
||||||
|
err = lock_clust_rec_read_check_and_lock(0,
|
||||||
|
clust_rec,
|
||||||
|
index, node->row_lock_mode,
|
||||||
|
LOCK_ORDINARY, thr);
|
||||||
|
}
|
||||||
|
|
||||||
if (err != DB_SUCCESS) {
|
if (err != DB_SUCCESS) {
|
||||||
|
|
||||||
return(err);
|
return(err);
|
||||||
}
|
}
|
||||||
@ -1205,22 +1206,24 @@ rec_loop:
|
|||||||
|
|
||||||
if (!consistent_read) {
|
if (!consistent_read) {
|
||||||
|
|
||||||
/* If innodb_locks_unsafe_for_binlog option is used,
|
/* If innodb_locks_unsafe_for_binlog option is used,
|
||||||
we lock only the record, i.e. next-key locking is
|
we lock only the record, i.e. next-key locking is
|
||||||
not used.
|
not used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( srv_locks_unsafe_for_binlog )
|
if (srv_locks_unsafe_for_binlog) {
|
||||||
{
|
err = sel_set_rec_lock(page_rec_get_next(rec),
|
||||||
err = sel_set_rec_lock(page_rec_get_next(rec), index,
|
index,
|
||||||
node->row_lock_mode, LOCK_REC_NOT_GAP, thr);
|
node->row_lock_mode,
|
||||||
}
|
LOCK_REC_NOT_GAP, thr);
|
||||||
else
|
} else {
|
||||||
{
|
err = sel_set_rec_lock(page_rec_get_next(rec),
|
||||||
err = sel_set_rec_lock(page_rec_get_next(rec), index,
|
index,
|
||||||
node->row_lock_mode, LOCK_ORDINARY, thr);
|
node->row_lock_mode,
|
||||||
}
|
LOCK_ORDINARY, thr);
|
||||||
if (err != DB_SUCCESS) {
|
}
|
||||||
|
|
||||||
|
if (err != DB_SUCCESS) {
|
||||||
/* Note that in this case we will store in pcur
|
/* Note that in this case we will store in pcur
|
||||||
the PREDECESSOR of the record we are waiting
|
the PREDECESSOR of the record we are waiting
|
||||||
the lock for */
|
the lock for */
|
||||||
@ -1245,21 +1248,18 @@ rec_loop:
|
|||||||
if (!consistent_read) {
|
if (!consistent_read) {
|
||||||
/* Try to place a lock on the index record */
|
/* Try to place a lock on the index record */
|
||||||
|
|
||||||
/* If innodb_locks_unsafe_for_binlog option is used,
|
/* If innodb_locks_unsafe_for_binlog option is used,
|
||||||
we lock only the record, i.e. next-key locking is
|
we lock only the record, i.e. next-key locking is
|
||||||
not used.
|
not used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( srv_locks_unsafe_for_binlog )
|
if (srv_locks_unsafe_for_binlog) {
|
||||||
{
|
err = sel_set_rec_lock(rec, index, node->row_lock_mode,
|
||||||
err = sel_set_rec_lock(rec, index, node->row_lock_mode,
|
|
||||||
LOCK_REC_NOT_GAP, thr);
|
LOCK_REC_NOT_GAP, thr);
|
||||||
}
|
} else {
|
||||||
else
|
err = sel_set_rec_lock(rec, index, node->row_lock_mode,
|
||||||
{
|
|
||||||
err = sel_set_rec_lock(rec, index, node->row_lock_mode,
|
|
||||||
LOCK_ORDINARY, thr);
|
LOCK_ORDINARY, thr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err != DB_SUCCESS) {
|
if (err != DB_SUCCESS) {
|
||||||
|
|
||||||
@ -3234,8 +3234,7 @@ rec_loop:
|
|||||||
we do not lock gaps. Supremum record is really
|
we do not lock gaps. Supremum record is really
|
||||||
a gap and therefore we do not set locks there. */
|
a gap and therefore we do not set locks there. */
|
||||||
|
|
||||||
if ( srv_locks_unsafe_for_binlog == FALSE )
|
if (srv_locks_unsafe_for_binlog == FALSE) {
|
||||||
{
|
|
||||||
err = sel_set_rec_lock(rec, index,
|
err = sel_set_rec_lock(rec, index,
|
||||||
prebuilt->select_lock_type,
|
prebuilt->select_lock_type,
|
||||||
LOCK_ORDINARY, thr);
|
LOCK_ORDINARY, thr);
|
||||||
@ -3337,11 +3336,18 @@ rec_loop:
|
|||||||
|
|
||||||
if (prebuilt->select_lock_type != LOCK_NONE
|
if (prebuilt->select_lock_type != LOCK_NONE
|
||||||
&& set_also_gap_locks) {
|
&& set_also_gap_locks) {
|
||||||
/* Try to place a lock on the index record */
|
|
||||||
|
|
||||||
err = sel_set_rec_lock(rec, index,
|
/* Try to place a gap lock on the index
|
||||||
|
record only if innodb_locks_unsafe_for_binlog
|
||||||
|
option is not set */
|
||||||
|
|
||||||
|
if (srv_locks_unsafe_for_binlog == FALSE) {
|
||||||
|
|
||||||
|
err = sel_set_rec_lock(rec, index,
|
||||||
prebuilt->select_lock_type,
|
prebuilt->select_lock_type,
|
||||||
LOCK_GAP, thr);
|
LOCK_GAP, thr);
|
||||||
|
}
|
||||||
|
|
||||||
if (err != DB_SUCCESS) {
|
if (err != DB_SUCCESS) {
|
||||||
|
|
||||||
goto lock_wait_or_error;
|
goto lock_wait_or_error;
|
||||||
@ -3363,11 +3369,18 @@ rec_loop:
|
|||||||
|
|
||||||
if (prebuilt->select_lock_type != LOCK_NONE
|
if (prebuilt->select_lock_type != LOCK_NONE
|
||||||
&& set_also_gap_locks) {
|
&& set_also_gap_locks) {
|
||||||
/* Try to place a lock on the index record */
|
|
||||||
|
|
||||||
err = sel_set_rec_lock(rec, index,
|
/* Try to place a gap lock on the index
|
||||||
|
record only if innodb_locks_unsafe_for_binlog
|
||||||
|
option is not set */
|
||||||
|
|
||||||
|
if (srv_locks_unsafe_for_binlog == FALSE) {
|
||||||
|
|
||||||
|
err = sel_set_rec_lock(rec, index,
|
||||||
prebuilt->select_lock_type,
|
prebuilt->select_lock_type,
|
||||||
LOCK_GAP, thr);
|
LOCK_GAP, thr);
|
||||||
|
}
|
||||||
|
|
||||||
if (err != DB_SUCCESS) {
|
if (err != DB_SUCCESS) {
|
||||||
|
|
||||||
goto lock_wait_or_error;
|
goto lock_wait_or_error;
|
||||||
@ -3401,19 +3414,16 @@ rec_loop:
|
|||||||
prebuilt->select_lock_type,
|
prebuilt->select_lock_type,
|
||||||
LOCK_REC_NOT_GAP, thr);
|
LOCK_REC_NOT_GAP, thr);
|
||||||
} else {
|
} else {
|
||||||
/* If innodb_locks_unsafe_for_binlog option is used,
|
/* If innodb_locks_unsafe_for_binlog option is used,
|
||||||
we lock only the record, i.e. next-key locking is
|
we lock only the record, i.e. next-key locking is
|
||||||
not used.
|
not used. */
|
||||||
*/
|
|
||||||
if ( srv_locks_unsafe_for_binlog )
|
if (srv_locks_unsafe_for_binlog) {
|
||||||
{
|
err = sel_set_rec_lock(rec, index,
|
||||||
err = sel_set_rec_lock(rec, index,
|
|
||||||
prebuilt->select_lock_type,
|
prebuilt->select_lock_type,
|
||||||
LOCK_REC_NOT_GAP, thr);
|
LOCK_REC_NOT_GAP, thr);
|
||||||
}
|
} else {
|
||||||
else
|
err = sel_set_rec_lock(rec, index,
|
||||||
{
|
|
||||||
err = sel_set_rec_lock(rec, index,
|
|
||||||
prebuilt->select_lock_type,
|
prebuilt->select_lock_type,
|
||||||
LOCK_ORDINARY, thr);
|
LOCK_ORDINARY, thr);
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ trx_purge_add_update_undo_to_history(
|
|||||||
flst_get_len(seg_header + TRX_UNDO_PAGE_LIST, mtr));
|
flst_get_len(seg_header + TRX_UNDO_PAGE_LIST, mtr));
|
||||||
|
|
||||||
mlog_write_ulint(rseg_header + TRX_RSEG_HISTORY_SIZE,
|
mlog_write_ulint(rseg_header + TRX_RSEG_HISTORY_SIZE,
|
||||||
hist_size + undo->size, MLOG_4BYTES, mtr);
|
hist_size + undo->size, MLOG_4BYTES, mtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the log as the first in the history list */
|
/* Add the log as the first in the history list */
|
||||||
@ -646,6 +646,27 @@ trx_purge_rseg_get_next_history_log(
|
|||||||
mutex_exit(&(rseg->mutex));
|
mutex_exit(&(rseg->mutex));
|
||||||
mtr_commit(&mtr);
|
mtr_commit(&mtr);
|
||||||
|
|
||||||
|
mutex_enter(&kernel_mutex);
|
||||||
|
|
||||||
|
/* Add debug code to track history list corruption reported
|
||||||
|
on the MySQL mailing list on Nov 9, 2004. The fut0lst.c
|
||||||
|
file-based list was corrupt. The prev node pointer was
|
||||||
|
FIL_NULL, even though the list length was over 8 million nodes!
|
||||||
|
We assume that purge truncates the history list in moderate
|
||||||
|
size pieces, and if we here reach the head of the list, the
|
||||||
|
list cannot be longer than 20 000 undo logs now. */
|
||||||
|
|
||||||
|
if (trx_sys->rseg_history_len > 20000) {
|
||||||
|
ut_print_timestamp(stderr);
|
||||||
|
fprintf(stderr,
|
||||||
|
" InnoDB: Warning: purge reached the head of the history list,\n"
|
||||||
|
"InnoDB: but its length is still reported as %lu! Make a detailed bug\n"
|
||||||
|
"InnoDB: report, and post it to bugs.mysql.com\n",
|
||||||
|
(ulong)trx_sys->rseg_history_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
mutex_exit(&kernel_mutex);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1241,7 +1241,7 @@ trx_undo_lists_init(
|
|||||||
|
|
||||||
if (page_no != FIL_NULL
|
if (page_no != FIL_NULL
|
||||||
&& srv_force_recovery < SRV_FORCE_NO_UNDO_LOG_SCAN) {
|
&& srv_force_recovery < SRV_FORCE_NO_UNDO_LOG_SCAN) {
|
||||||
|
|
||||||
undo = trx_undo_mem_create_at_db_start(rseg, i,
|
undo = trx_undo_mem_create_at_db_start(rseg, i,
|
||||||
page_no, &mtr);
|
page_no, &mtr);
|
||||||
size += undo->size;
|
size += undo->size;
|
||||||
|
@ -348,7 +348,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
|
|||||||
FTB_EXPR *top_ftbe=ftbe->up->up;
|
FTB_EXPR *top_ftbe=ftbe->up->up;
|
||||||
ftbw->docid[0]=HA_OFFSET_ERROR;
|
ftbw->docid[0]=HA_OFFSET_ERROR;
|
||||||
for (ftbe=ftbw->up; ftbe != top_ftbe; ftbe=ftbe->up)
|
for (ftbe=ftbw->up; ftbe != top_ftbe; ftbe=ftbe->up)
|
||||||
if (ftbe->flags & FTB_FLAG_YES)
|
if (!(ftbe->flags & FTB_FLAG_NO))
|
||||||
ftbe->yweaks++;
|
ftbe->yweaks++;
|
||||||
ftbe=0;
|
ftbe=0;
|
||||||
break;
|
break;
|
||||||
@ -356,7 +356,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
|
|||||||
}
|
}
|
||||||
if (!ftbe)
|
if (!ftbe)
|
||||||
continue;
|
continue;
|
||||||
/* 3 */
|
/* 4 */
|
||||||
if (!is_tree_inited(& ftb->no_dupes))
|
if (!is_tree_inited(& ftb->no_dupes))
|
||||||
init_tree(& ftb->no_dupes,0,0,sizeof(my_off_t),
|
init_tree(& ftb->no_dupes,0,0,sizeof(my_off_t),
|
||||||
_ftb_no_dupes_cmp,0,0,0);
|
_ftb_no_dupes_cmp,0,0,0);
|
||||||
|
@ -296,3 +296,12 @@ FD C3BD FD 1
|
|||||||
FE C3BE FE 1
|
FE C3BE FE 1
|
||||||
FF C3BF FF 1
|
FF C3BF FF 1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
select 'a' regexp 'A' collate latin1_general_ci;
|
||||||
|
'a' regexp 'A' collate latin1_general_ci
|
||||||
|
1
|
||||||
|
select 'a' regexp 'A' collate latin1_general_cs;
|
||||||
|
'a' regexp 'A' collate latin1_general_cs
|
||||||
|
0
|
||||||
|
select 'a' regexp 'A' collate latin1_bin;
|
||||||
|
'a' regexp 'A' collate latin1_bin
|
||||||
|
0
|
||||||
|
@ -16,12 +16,34 @@ SET AUTOCOMMIT=0;
|
|||||||
DELETE from t1;
|
DELETE from t1;
|
||||||
SET AUTOCOMMIT=1;
|
SET AUTOCOMMIT=1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
|
create table t1 (
|
||||||
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
|
a bigint not null,
|
||||||
|
b bigint not null default 0,
|
||||||
|
c bigint not null default 0,
|
||||||
|
d bigint not null default 0,
|
||||||
|
e bigint not null default 0,
|
||||||
|
f bigint not null default 0,
|
||||||
|
g bigint not null default 0,
|
||||||
|
h bigint not null default 0,
|
||||||
|
i bigint not null default 0,
|
||||||
|
j bigint not null default 0,
|
||||||
|
primary key (a,b,c,d,e,f,g,h,i,j));
|
||||||
|
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
|
||||||
delete from t1 where a=26;
|
delete from t1 where a=26;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
|
create table t1 (
|
||||||
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
|
a bigint not null,
|
||||||
|
b bigint not null default 0,
|
||||||
|
c bigint not null default 0,
|
||||||
|
d bigint not null default 0,
|
||||||
|
e bigint not null default 0,
|
||||||
|
f bigint not null default 0,
|
||||||
|
g bigint not null default 0,
|
||||||
|
h bigint not null default 0,
|
||||||
|
i bigint not null default 0,
|
||||||
|
j bigint not null default 0,
|
||||||
|
primary key (a,b,c,d,e,f,g,h,i,j));
|
||||||
|
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
|
||||||
delete from t1 where a=27;
|
delete from t1 where a=27;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
CREATE TABLE `t1` (
|
CREATE TABLE `t1` (
|
||||||
|
@ -190,6 +190,14 @@ a
|
|||||||
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
|
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
|
||||||
a
|
a
|
||||||
aaa10 bbb20
|
aaa10 bbb20
|
||||||
|
select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode);
|
||||||
|
a
|
||||||
|
aaa20 bbb15
|
||||||
|
aaa30 bbb10
|
||||||
|
select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode);
|
||||||
|
a
|
||||||
|
aaa20 bbb15
|
||||||
|
aaa30 bbb10
|
||||||
drop table t1;
|
drop table t1;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
id int(11),
|
id int(11),
|
||||||
|
@ -233,3 +233,10 @@ SELECT * FROM t1 WHERE B is not null;
|
|||||||
a B
|
a B
|
||||||
1 1
|
1 1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (pseudo char(35) PRIMARY KEY, date int(10) unsigned NOT NULL) ENGINE=HEAP;
|
||||||
|
INSERT INTO t1 VALUES ('massecot',1101106491),('altec',1101106492),('stitch+',1101106304),('Seb Corgan',1101106305),('beerfilou',1101106263),('flaker',1101106529),('joce8',5),('M4vrick',1101106418),('gabay008',1101106525),('Vamp irX',1101106291),('ZoomZip',1101106546),('rip666',1101106502),('CBP ',1101106397),('guezpard',1101106496);
|
||||||
|
DELETE FROM t1 WHERE date<1101106546;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
pseudo date
|
||||||
|
ZoomZip 1101106546
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -1630,6 +1630,24 @@ show status like "binlog_cache_disk_use";
|
|||||||
Variable_name Value
|
Variable_name Value
|
||||||
Binlog_cache_disk_use 1
|
Binlog_cache_disk_use 1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (c char(10), index (c,c)) engine=innodb;
|
||||||
|
ERROR 42S21: Duplicate column name 'c'
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
create table t1 (c1 char(10), c2 char(10)) engine=innodb;
|
||||||
|
alter table t1 add key (c1,c1);
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
alter table t1 add key (c2,c1,c1);
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
alter table t1 add key (c1,c2,c1);
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
alter table t1 add key (c1,c1,c2);
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
drop table t1;
|
||||||
create table t1 (x bigint unsigned not null primary key) engine=innodb;
|
create table t1 (x bigint unsigned not null primary key) engine=innodb;
|
||||||
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
|
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
|
@ -311,3 +311,21 @@ test.t1 check status OK
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (c char(10), index (c(0)));
|
create table t1 (c char(10), index (c(0)));
|
||||||
ERROR HY000: Key part 'c' length cannot be 0
|
ERROR HY000: Key part 'c' length cannot be 0
|
||||||
|
create table t1 (c char(10), index (c,c));
|
||||||
|
ERROR 42S21: Duplicate column name 'c'
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1));
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2));
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1));
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
create table t1 (c1 char(10), c2 char(10));
|
||||||
|
alter table t1 add key (c1,c1);
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
alter table t1 add key (c2,c1,c1);
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
alter table t1 add key (c1,c2,c1);
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
alter table t1 add key (c1,c1,c2);
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
drop table t1;
|
||||||
|
@ -44,6 +44,51 @@ a b c
|
|||||||
7 8 3
|
7 8 3
|
||||||
8 2 3
|
8 2 3
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
a int unsigned NOT NULL PRIMARY KEY,
|
||||||
|
b int unsigned,
|
||||||
|
c int unsigned,
|
||||||
|
UNIQUE 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 order by a;
|
||||||
|
a b c
|
||||||
|
2 NULL 2
|
||||||
|
3 NULL 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 (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
|
||||||
|
select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
|
||||||
|
a b c
|
||||||
|
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
|
||||||
|
insert into t1 values(5,1,1);
|
||||||
|
ERROR 23000: Duplicate entry '5' for key 1
|
||||||
|
drop table t1;
|
||||||
CREATE TABLE t2 (
|
CREATE TABLE t2 (
|
||||||
a int unsigned NOT NULL PRIMARY KEY,
|
a int unsigned NOT NULL PRIMARY KEY,
|
||||||
b int unsigned not null,
|
b int unsigned not null,
|
||||||
@ -87,6 +132,13 @@ a b c
|
|||||||
7 8 3
|
7 8 3
|
||||||
8 2 3
|
8 2 3
|
||||||
drop table t2;
|
drop table t2;
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
a int unsigned NOT NULL PRIMARY KEY,
|
||||||
|
b int unsigned not null,
|
||||||
|
c int unsigned,
|
||||||
|
UNIQUE USING HASH (b, c)
|
||||||
|
) engine=ndbcluster;
|
||||||
|
ERROR 42000: Column 'c' is used with UNIQUE or INDEX but is not defined as NOT NULL
|
||||||
CREATE TABLE t3 (
|
CREATE TABLE t3 (
|
||||||
a int unsigned NOT NULL,
|
a int unsigned NOT NULL,
|
||||||
b int unsigned not null,
|
b int unsigned not null,
|
||||||
|
@ -450,6 +450,27 @@ PREPARE stmt FROM 'UPDATE t1 AS P1 INNER JOIN (SELECT N FROM t1 GROUP BY N HAVIN
|
|||||||
EXECUTE stmt;
|
EXECUTE stmt;
|
||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
prepare stmt from "select ? is null, ? is not null, ?";
|
||||||
|
select @no_such_var is null, @no_such_var is not null, @no_such_var;
|
||||||
|
@no_such_var is null @no_such_var is not null @no_such_var
|
||||||
|
1 0 NULL
|
||||||
|
execute stmt using @no_such_var, @no_such_var, @no_such_var;
|
||||||
|
? is null ? is not null ?
|
||||||
|
1 0 NULL
|
||||||
|
set @var='abc';
|
||||||
|
select @var is null, @var is not null, @var;
|
||||||
|
@var is null @var is not null @var
|
||||||
|
0 1 abc
|
||||||
|
execute stmt using @var, @var, @var;
|
||||||
|
? is null ? is not null ?
|
||||||
|
0 1 abc
|
||||||
|
set @var=null;
|
||||||
|
select @var is null, @var is not null, @var;
|
||||||
|
@var is null @var is not null @var
|
||||||
|
1 0 NULL
|
||||||
|
execute stmt using @var, @var, @var;
|
||||||
|
? is null ? is not null ?
|
||||||
|
1 0 NULL
|
||||||
create table t1 (a varchar(20));
|
create table t1 (a varchar(20));
|
||||||
insert into t1 values ('foo');
|
insert into t1 values ('foo');
|
||||||
prepare stmt FROM 'SELECT char_length (a) FROM t1';
|
prepare stmt FROM 'SELECT char_length (a) FROM t1';
|
||||||
|
@ -220,7 +220,8 @@ insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
|
|||||||
update t1 set y=x;
|
update t1 set y=x;
|
||||||
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0;
|
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE t1 ref y y 5 const 1 Using where
|
||||||
|
1 SIMPLE t2 range x x 5 NULL 4 Range checked for each record (index map: 0x1)
|
||||||
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0;
|
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
|
@ -1998,3 +1998,18 @@ ac
|
|||||||
700
|
700
|
||||||
NULL
|
NULL
|
||||||
drop tables t1,t2;
|
drop tables t1,t2;
|
||||||
|
create table t1 (a int not null, b int not null, c int, primary key (a,b));
|
||||||
|
insert into t1 values (1,1,1), (2,2,2), (3,3,3);
|
||||||
|
set @b:= 0;
|
||||||
|
explain select sum(a) from t1 where b > @b;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index
|
||||||
|
set @a:= (select sum(a) from t1 where b > @b);
|
||||||
|
explain select a from t1 where c=2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
|
||||||
|
do @a:= (select sum(a) from t1 where b > @b);
|
||||||
|
explain select a from t1 where c=2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
|
||||||
|
drop table t1;
|
||||||
|
@ -682,8 +682,8 @@ id txt
|
|||||||
3 NULL
|
3 NULL
|
||||||
1 Chevy
|
1 Chevy
|
||||||
drop table t1;
|
drop table t1;
|
||||||
CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1)));
|
CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d));
|
||||||
INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
|
INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
|
||||||
select max(i) from t1 where c = '';
|
select max(i) from t1 where c = '';
|
||||||
max(i)
|
max(i)
|
||||||
4
|
4
|
||||||
|
@ -53,3 +53,10 @@ SELECT
|
|||||||
hex(@l:=convert(@u using latin1)),
|
hex(@l:=convert(@u using latin1)),
|
||||||
a=@l FROM t1;
|
a=@l FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #6737: REGEXP gives wrong result with case sensitive collation
|
||||||
|
#
|
||||||
|
select 'a' regexp 'A' collate latin1_general_ci;
|
||||||
|
select 'a' regexp 'A' collate latin1_general_cs;
|
||||||
|
select 'a' regexp 'A' collate latin1_bin;
|
||||||
|
@ -29,12 +29,34 @@ drop table t1;
|
|||||||
# (This assumes a block size of 1024)
|
# (This assumes a block size of 1024)
|
||||||
#
|
#
|
||||||
|
|
||||||
create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
|
create table t1 (
|
||||||
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
|
a bigint not null,
|
||||||
|
b bigint not null default 0,
|
||||||
|
c bigint not null default 0,
|
||||||
|
d bigint not null default 0,
|
||||||
|
e bigint not null default 0,
|
||||||
|
f bigint not null default 0,
|
||||||
|
g bigint not null default 0,
|
||||||
|
h bigint not null default 0,
|
||||||
|
i bigint not null default 0,
|
||||||
|
j bigint not null default 0,
|
||||||
|
primary key (a,b,c,d,e,f,g,h,i,j));
|
||||||
|
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
|
||||||
delete from t1 where a=26;
|
delete from t1 where a=26;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
|
create table t1 (
|
||||||
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
|
a bigint not null,
|
||||||
|
b bigint not null default 0,
|
||||||
|
c bigint not null default 0,
|
||||||
|
d bigint not null default 0,
|
||||||
|
e bigint not null default 0,
|
||||||
|
f bigint not null default 0,
|
||||||
|
g bigint not null default 0,
|
||||||
|
h bigint not null default 0,
|
||||||
|
i bigint not null default 0,
|
||||||
|
j bigint not null default 0,
|
||||||
|
primary key (a,b,c,d,e,f,g,h,i,j));
|
||||||
|
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
|
||||||
delete from t1 where a=27;
|
delete from t1 where a=27;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
@ -98,6 +98,8 @@ select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
|
|||||||
select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
|
select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
|
||||||
select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
|
select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
|
||||||
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
|
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
|
||||||
|
select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode);
|
||||||
|
select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode);
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -174,3 +174,14 @@ CREATE TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP;
|
|||||||
INSERT INTO t1 VALUES(1,1), (1,NULL);
|
INSERT INTO t1 VALUES(1,1), (1,NULL);
|
||||||
SELECT * FROM t1 WHERE B is not null;
|
SELECT * FROM t1 WHERE B is not null;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #6748
|
||||||
|
# heap_rfirst() doesn't work (and never did!)
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (pseudo char(35) PRIMARY KEY, date int(10) unsigned NOT NULL) ENGINE=HEAP;
|
||||||
|
INSERT INTO t1 VALUES ('massecot',1101106491),('altec',1101106492),('stitch+',1101106304),('Seb Corgan',1101106305),('beerfilou',1101106263),('flaker',1101106529),('joce8',5),('M4vrick',1101106418),('gabay008',1101106525),('Vamp irX',1101106291),('ZoomZip',1101106546),('rip666',1101106502),('CBP ',1101106397),('guezpard',1101106496);
|
||||||
|
DELETE FROM t1 WHERE date<1101106546;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
@ -1180,6 +1180,28 @@ select count(*) from t1 where x = 18446744073709551601;
|
|||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #6126: Duplicate columns in keys gives misleading error message
|
||||||
|
#
|
||||||
|
--error 1060
|
||||||
|
create table t1 (c char(10), index (c,c)) engine=innodb;
|
||||||
|
--error 1060
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
|
||||||
|
--error 1060
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
|
||||||
|
--error 1060
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
|
||||||
|
create table t1 (c1 char(10), c2 char(10)) engine=innodb;
|
||||||
|
--error 1060
|
||||||
|
alter table t1 add key (c1,c1);
|
||||||
|
--error 1060
|
||||||
|
alter table t1 add key (c2,c1,c1);
|
||||||
|
--error 1060
|
||||||
|
alter table t1 add key (c1,c2,c1);
|
||||||
|
--error 1060
|
||||||
|
alter table t1 add key (c1,c1,c2);
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
# Test for testable InnoDB status variables. This test
|
# Test for testable InnoDB status variables. This test
|
||||||
# uses previous ones(pages_created, rows_deleted, ...).
|
# uses previous ones(pages_created, rows_deleted, ...).
|
||||||
show status like "Innodb_buffer_pool_pages_total";
|
show status like "Innodb_buffer_pool_pages_total";
|
||||||
|
@ -301,3 +301,26 @@ drop table t1;
|
|||||||
|
|
||||||
--error 1391
|
--error 1391
|
||||||
create table t1 (c char(10), index (c(0)));
|
create table t1 (c char(10), index (c(0)));
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #6126: Duplicate columns in keys should fail
|
||||||
|
# Bug #6252: (dup)
|
||||||
|
#
|
||||||
|
--error 1060
|
||||||
|
create table t1 (c char(10), index (c,c));
|
||||||
|
--error 1060
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1));
|
||||||
|
--error 1060
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2));
|
||||||
|
--error 1060
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1));
|
||||||
|
create table t1 (c1 char(10), c2 char(10));
|
||||||
|
--error 1060
|
||||||
|
alter table t1 add key (c1,c1);
|
||||||
|
--error 1060
|
||||||
|
alter table t1 add key (c2,c1,c1);
|
||||||
|
--error 1060
|
||||||
|
alter table t1 add key (c1,c2,c1);
|
||||||
|
--error 1060
|
||||||
|
alter table t1 add key (c1,c1,c2);
|
||||||
|
drop table t1;
|
||||||
|
@ -199,7 +199,7 @@ insert into t4 values (1, "Automatic");
|
|||||||
select * from t4;
|
select * from t4;
|
||||||
|
|
||||||
# Remove the table from NDB
|
# Remove the table from NDB
|
||||||
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t4 > /dev/null ;
|
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 > /dev/null ;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test that correct error is returned
|
# Test that correct error is returned
|
||||||
@ -230,7 +230,7 @@ select * from t4;
|
|||||||
flush tables;
|
flush tables;
|
||||||
|
|
||||||
# Remove the table from NDB
|
# Remove the table from NDB
|
||||||
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t4 > /dev/null ;
|
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 > /dev/null ;
|
||||||
|
|
||||||
SHOW TABLES;
|
SHOW TABLES;
|
||||||
|
|
||||||
@ -264,8 +264,8 @@ insert into t8 values (8, "myisam table 8");
|
|||||||
insert into t9 values (9);
|
insert into t9 values (9);
|
||||||
|
|
||||||
# Remove t3, t5 from NDB
|
# Remove t3, t5 from NDB
|
||||||
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t3 > /dev/null ;
|
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ;
|
||||||
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t5 > /dev/null ;
|
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
|
||||||
# Remove t6, t7 from disk
|
# Remove t6, t7 from disk
|
||||||
system rm var/master-data/test/t6.frm > /dev/null ;
|
system rm var/master-data/test/t6.frm > /dev/null ;
|
||||||
system rm var/master-data/test/t7.frm > /dev/null ;
|
system rm var/master-data/test/t7.frm > /dev/null ;
|
||||||
@ -306,8 +306,8 @@ insert into t8 values (8, "myisam table 8");
|
|||||||
insert into t9 values (9);
|
insert into t9 values (9);
|
||||||
|
|
||||||
# Remove t3, t5 from NDB
|
# Remove t3, t5 from NDB
|
||||||
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t3 > /dev/null ;
|
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ;
|
||||||
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t5 > /dev/null ;
|
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
|
||||||
# Remove t6, t7 from disk
|
# Remove t6, t7 from disk
|
||||||
system rm var/master-data/test/t6.frm > /dev/null ;
|
system rm var/master-data/test/t6.frm > /dev/null ;
|
||||||
system rm var/master-data/test/t7.frm > /dev/null ;
|
system rm var/master-data/test/t7.frm > /dev/null ;
|
||||||
@ -479,4 +479,4 @@ create table t10 (
|
|||||||
|
|
||||||
insert into t10 values (1, 'kalle');
|
insert into t10 values (1, 'kalle');
|
||||||
|
|
||||||
--exec $NDB_TOOLS_DIR/ndb_drop_table -d test `$NDB_TOOLS_DIR/ndb_show_tables | grep BLOB` > /dev/null 2>&1 || true
|
--exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test `$NDB_TOOLS_DIR/ndb_show_tables --no-defaults | grep BLOB` > /dev/null 2>&1 || true
|
||||||
|
@ -30,6 +30,32 @@ select * from t1 order by a;
|
|||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Indexing NULL values
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
a int unsigned NOT NULL PRIMARY KEY,
|
||||||
|
b int unsigned,
|
||||||
|
c int unsigned,
|
||||||
|
UNIQUE 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 order by a;
|
||||||
|
|
||||||
|
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;
|
||||||
|
-- error 1062
|
||||||
|
insert into t1 values(5,1,1);
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Show use of UNIQUE USING HASH indexes
|
# Show use of UNIQUE USING HASH indexes
|
||||||
@ -58,6 +84,14 @@ select * from t2 order by a;
|
|||||||
|
|
||||||
drop table t2;
|
drop table t2;
|
||||||
|
|
||||||
|
-- error 1121
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
a int unsigned NOT NULL PRIMARY KEY,
|
||||||
|
b int unsigned not null,
|
||||||
|
c int unsigned,
|
||||||
|
UNIQUE USING HASH (b, c)
|
||||||
|
) engine=ndbcluster;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Show use of PRIMARY KEY USING HASH indexes
|
# Show use of PRIMARY KEY USING HASH indexes
|
||||||
#
|
#
|
||||||
|
@ -458,6 +458,20 @@ EXECUTE stmt;
|
|||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#6297 "prepared statement, wrong handling of <parameter> IS NULL"
|
||||||
|
# Test that placeholders work with IS NULL/IS NOT NULL clauses.
|
||||||
|
#
|
||||||
|
prepare stmt from "select ? is null, ? is not null, ?";
|
||||||
|
select @no_such_var is null, @no_such_var is not null, @no_such_var;
|
||||||
|
execute stmt using @no_such_var, @no_such_var, @no_such_var;
|
||||||
|
set @var='abc';
|
||||||
|
select @var is null, @var is not null, @var;
|
||||||
|
execute stmt using @var, @var, @var;
|
||||||
|
set @var=null;
|
||||||
|
select @var is null, @var is not null, @var;
|
||||||
|
execute stmt using @var, @var, @var;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug#6102 "Server crash with prepared statement and blank after
|
# Bug#6102 "Server crash with prepared statement and blank after
|
||||||
# function name"
|
# function name"
|
||||||
@ -469,3 +483,4 @@ insert into t1 values ('foo');
|
|||||||
--error 1305
|
--error 1305
|
||||||
prepare stmt FROM 'SELECT char_length (a) FROM t1';
|
prepare stmt FROM 'SELECT char_length (a) FROM t1';
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ wait_for_slave_to_stop;
|
|||||||
|
|
||||||
# The following test can't be done because the result of Pos will differ
|
# The following test can't be done because the result of Pos will differ
|
||||||
# on different computers
|
# on different computers
|
||||||
# --replace_result 9306 9999 3334 9999 3335 9999
|
# --replace_result $MASTER_MYPORT MASTER_PORT
|
||||||
# show slave status;
|
# show slave status;
|
||||||
|
|
||||||
set global sql_slave_skip_counter=1;
|
set global sql_slave_skip_counter=1;
|
||||||
|
@ -1287,3 +1287,22 @@ INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'
|
|||||||
SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
|
SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
|
||||||
SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
|
SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
|
||||||
drop tables t1,t2;
|
drop tables t1,t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test for bug #6462. "Same request on same data returns different
|
||||||
|
# results." a.k.a. "Proper cleanup of subqueries is missing for
|
||||||
|
# SET and DO statements".
|
||||||
|
#
|
||||||
|
create table t1 (a int not null, b int not null, c int, primary key (a,b));
|
||||||
|
insert into t1 values (1,1,1), (2,2,2), (3,3,3);
|
||||||
|
set @b:= 0;
|
||||||
|
# Let us check that subquery will use covering index
|
||||||
|
explain select sum(a) from t1 where b > @b;
|
||||||
|
# This should not crash -debug server due to failing assertion
|
||||||
|
set @a:= (select sum(a) from t1 where b > @b);
|
||||||
|
# And this should not falsely report index usage
|
||||||
|
explain select a from t1 where c=2;
|
||||||
|
# Same for DO statement
|
||||||
|
do @a:= (select sum(a) from t1 where b > @b);
|
||||||
|
explain select a from t1 where c=2;
|
||||||
|
drop table t1;
|
||||||
|
@ -369,8 +369,8 @@ explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
|
|||||||
select * from t1 where txt='Chevy' or txt is NULL order by txt;
|
select * from t1 where txt='Chevy' or txt is NULL order by txt;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1)));
|
CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d));
|
||||||
INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
|
INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
|
||||||
select max(i) from t1 where c = '';
|
select max(i) from t1 where c = '';
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
@ -228,6 +228,7 @@ static int add_collation(CHARSET_INFO *cs)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
uchar *sort_order= all_charsets[cs->number]->sort_order;
|
||||||
simple_cs_init_functions(all_charsets[cs->number]);
|
simple_cs_init_functions(all_charsets[cs->number]);
|
||||||
new->mbminlen= 1;
|
new->mbminlen= 1;
|
||||||
new->mbmaxlen= 1;
|
new->mbmaxlen= 1;
|
||||||
@ -236,6 +237,16 @@ static int add_collation(CHARSET_INFO *cs)
|
|||||||
all_charsets[cs->number]->state |= MY_CS_LOADED;
|
all_charsets[cs->number]->state |= MY_CS_LOADED;
|
||||||
}
|
}
|
||||||
all_charsets[cs->number]->state|= MY_CS_AVAILABLE;
|
all_charsets[cs->number]->state|= MY_CS_AVAILABLE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Check if case sensitive sort order: A < a < B.
|
||||||
|
We need MY_CS_FLAG for regex library, and for
|
||||||
|
case sensitivity flag for 5.0 client protocol,
|
||||||
|
to support isCaseSensitive() method in JDBC driver
|
||||||
|
*/
|
||||||
|
if (sort_order && sort_order['A'] < sort_order['a'] &&
|
||||||
|
sort_order['a'] < sort_order['B'])
|
||||||
|
all_charsets[cs->number]->state|= MY_CS_CSSORT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Next QMGR 1
|
Next QMGR 1
|
||||||
Next NDBCNTR 1000
|
Next NDBCNTR 1000
|
||||||
Next NDBFS 2000
|
Next NDBFS 2000
|
||||||
Next DBACC 3001
|
Next DBACC 3002
|
||||||
Next DBTUP 4013
|
Next DBTUP 4013
|
||||||
Next DBLQH 5042
|
Next DBLQH 5042
|
||||||
Next DBDICT 6006
|
Next DBDICT 6006
|
||||||
@ -393,6 +393,7 @@ Failed Create Table:
|
|||||||
--------------------
|
--------------------
|
||||||
7173: Create table failed due to not sufficient number of fragment or
|
7173: Create table failed due to not sufficient number of fragment or
|
||||||
replica records.
|
replica records.
|
||||||
|
3001: Fail create 1st fragment
|
||||||
4007 12001: Fail create 1st fragment
|
4007 12001: Fail create 1st fragment
|
||||||
4008 12002: Fail create 2nd fragment
|
4008 12002: Fail create 2nd fragment
|
||||||
4009 12003: Fail create 1st attribute in 1st fragment
|
4009 12003: Fail create 1st attribute in 1st fragment
|
||||||
|
@ -1062,7 +1062,21 @@ void Dbacc::execACCFRAGREQ(Signal* signal)
|
|||||||
{
|
{
|
||||||
const AccFragReq * const req = (AccFragReq*)&signal->theData[0];
|
const AccFragReq * const req = (AccFragReq*)&signal->theData[0];
|
||||||
jamEntry();
|
jamEntry();
|
||||||
|
if (ERROR_INSERTED(3001)) {
|
||||||
|
jam();
|
||||||
|
addFragRefuse(signal, 1);
|
||||||
|
CLEAR_ERROR_INSERT_VALUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
tabptr.i = req->tableId;
|
tabptr.i = req->tableId;
|
||||||
|
#ifndef VM_TRACE
|
||||||
|
// config mismatch - do not crash if release compiled
|
||||||
|
if (tabptr.i >= ctablesize) {
|
||||||
|
jam();
|
||||||
|
addFragRefuse(signal, 800);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
ptrCheckGuard(tabptr, ctablesize, tabrec);
|
ptrCheckGuard(tabptr, ctablesize, tabrec);
|
||||||
ndbrequire((req->reqInfo & 0xF) == ZADDFRAG);
|
ndbrequire((req->reqInfo & 0xF) == ZADDFRAG);
|
||||||
ndbrequire(!getrootfragmentrec(signal, rootfragrecptr, req->fragId));
|
ndbrequire(!getrootfragmentrec(signal, rootfragrecptr, req->fragId));
|
||||||
|
@ -69,6 +69,17 @@ void Dbtup::execTUPFRAGREQ(Signal* signal)
|
|||||||
Uint32 noOfAttributeGroups = signal->theData[12];
|
Uint32 noOfAttributeGroups = signal->theData[12];
|
||||||
Uint32 globalCheckpointIdIndicator = signal->theData[13];
|
Uint32 globalCheckpointIdIndicator = signal->theData[13];
|
||||||
|
|
||||||
|
#ifndef VM_TRACE
|
||||||
|
// config mismatch - do not crash if release compiled
|
||||||
|
if (regTabPtr.i >= cnoOfTablerec) {
|
||||||
|
ljam();
|
||||||
|
signal->theData[0] = userptr;
|
||||||
|
signal->theData[1] = 800;
|
||||||
|
sendSignal(userblockref, GSN_TUPFRAGREF, signal, 2, JBB);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ptrCheckGuard(regTabPtr, cnoOfTablerec, tablerec);
|
ptrCheckGuard(regTabPtr, cnoOfTablerec, tablerec);
|
||||||
if (cfirstfreeFragopr == RNIL) {
|
if (cfirstfreeFragopr == RNIL) {
|
||||||
ljam();
|
ljam();
|
||||||
|
@ -1480,8 +1480,10 @@ runTestDictionaryPerf(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int runFailAddFragment(NDBT_Context* ctx, NDBT_Step* step){
|
int runFailAddFragment(NDBT_Context* ctx, NDBT_Step* step){
|
||||||
|
static int acclst[] = { 3001 };
|
||||||
static int tuplst[] = { 4007, 4008, 4009, 4010, 4011, 4012 };
|
static int tuplst[] = { 4007, 4008, 4009, 4010, 4011, 4012 };
|
||||||
static int tuxlst[] = { 12001, 12002, 12003, 12004, 12005, 12006 };
|
static int tuxlst[] = { 12001, 12002, 12003, 12004, 12005, 12006 };
|
||||||
|
static unsigned acccnt = sizeof(acclst)/sizeof(acclst[0]);
|
||||||
static unsigned tupcnt = sizeof(tuplst)/sizeof(tuplst[0]);
|
static unsigned tupcnt = sizeof(tuplst)/sizeof(tuplst[0]);
|
||||||
static unsigned tuxcnt = sizeof(tuxlst)/sizeof(tuxlst[0]);
|
static unsigned tuxcnt = sizeof(tuxlst)/sizeof(tuxlst[0]);
|
||||||
|
|
||||||
@ -1509,6 +1511,19 @@ int runFailAddFragment(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
(void)pDic->dropTable(tab.getName());
|
(void)pDic->dropTable(tab.getName());
|
||||||
|
|
||||||
for (int l = 0; l < loops; l++) {
|
for (int l = 0; l < loops; l++) {
|
||||||
|
for (unsigned i0 = 0; i0 < acccnt; i0++) {
|
||||||
|
unsigned j = (l == 0 ? i0 : myRandom48(acccnt));
|
||||||
|
int errval = acclst[j];
|
||||||
|
g_info << "insert error node=" << nodeId << " value=" << errval << endl;
|
||||||
|
CHECK2(restarter.insertErrorInNode(nodeId, errval) == 0,
|
||||||
|
"failed to set error insert");
|
||||||
|
CHECK2(pDic->createTable(tab) != 0,
|
||||||
|
"failed to fail after error insert " << errval);
|
||||||
|
CHECK2(pDic->createTable(tab) == 0,
|
||||||
|
pDic->getNdbError());
|
||||||
|
CHECK2(pDic->dropTable(tab.getName()) == 0,
|
||||||
|
pDic->getNdbError());
|
||||||
|
}
|
||||||
for (unsigned i1 = 0; i1 < tupcnt; i1++) {
|
for (unsigned i1 = 0; i1 < tupcnt; i1++) {
|
||||||
unsigned j = (l == 0 ? i1 : myRandom48(tupcnt));
|
unsigned j = (l == 0 ? i1 : myRandom48(tupcnt));
|
||||||
int errval = tuplst[j];
|
int errval = tuplst[j];
|
||||||
@ -1638,7 +1653,7 @@ TESTCASE("DictionaryPerf",
|
|||||||
INITIALIZER(runTestDictionaryPerf);
|
INITIALIZER(runTestDictionaryPerf);
|
||||||
}
|
}
|
||||||
TESTCASE("FailAddFragment",
|
TESTCASE("FailAddFragment",
|
||||||
"Fail add fragment or attribute in TUP or TUX\n"){
|
"Fail add fragment or attribute in ACC or TUP or TUX\n"){
|
||||||
INITIALIZER(runFailAddFragment);
|
INITIALIZER(runFailAddFragment);
|
||||||
}
|
}
|
||||||
NDBT_TESTSUITE_END(testDict);
|
NDBT_TESTSUITE_END(testDict);
|
||||||
@ -1650,5 +1665,3 @@ int main(int argc, const char** argv){
|
|||||||
myRandom48Init(NdbTick_CurrentMillisecond());
|
myRandom48Init(NdbTick_CurrentMillisecond());
|
||||||
return testDict.execute(argc, argv);
|
return testDict.execute(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -796,7 +796,8 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
|
|||||||
error= create_unique_index(unique_index_name, key_info);
|
error= create_unique_index(unique_index_name, key_info);
|
||||||
break;
|
break;
|
||||||
case UNIQUE_INDEX:
|
case UNIQUE_INDEX:
|
||||||
error= create_unique_index(unique_index_name, key_info);
|
if (!(error= check_index_fields_not_null(i)))
|
||||||
|
error= create_unique_index(unique_index_name, key_info);
|
||||||
break;
|
break;
|
||||||
case ORDERED_INDEX:
|
case ORDERED_INDEX:
|
||||||
error= create_ordered_index(index_name, key_info);
|
error= create_ordered_index(index_name, key_info);
|
||||||
@ -848,6 +849,26 @@ NDB_INDEX_TYPE ha_ndbcluster::get_index_type_from_table(uint inx) const
|
|||||||
ORDERED_INDEX);
|
ORDERED_INDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ha_ndbcluster::check_index_fields_not_null(uint inx)
|
||||||
|
{
|
||||||
|
KEY* key_info= table->key_info + inx;
|
||||||
|
KEY_PART_INFO* key_part= key_info->key_part;
|
||||||
|
KEY_PART_INFO* end= key_part+key_info->key_parts;
|
||||||
|
DBUG_ENTER("check_index_fields_not_null");
|
||||||
|
|
||||||
|
for (; key_part != end; key_part++)
|
||||||
|
{
|
||||||
|
Field* field= key_part->field;
|
||||||
|
if (field->maybe_null())
|
||||||
|
{
|
||||||
|
my_printf_error(ER_NULL_COLUMN_IN_INDEX,ER(ER_NULL_COLUMN_IN_INDEX),
|
||||||
|
MYF(0),field->field_name);
|
||||||
|
DBUG_RETURN(ER_NULL_COLUMN_IN_INDEX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
void ha_ndbcluster::release_metadata()
|
void ha_ndbcluster::release_metadata()
|
||||||
{
|
{
|
||||||
|
@ -160,7 +160,8 @@ class ha_ndbcluster: public handler
|
|||||||
void release_metadata();
|
void release_metadata();
|
||||||
NDB_INDEX_TYPE get_index_type(uint idx_no) const;
|
NDB_INDEX_TYPE get_index_type(uint idx_no) const;
|
||||||
NDB_INDEX_TYPE get_index_type_from_table(uint index_no) const;
|
NDB_INDEX_TYPE get_index_type_from_table(uint index_no) const;
|
||||||
|
int check_index_fields_not_null(uint index_no);
|
||||||
|
|
||||||
int pk_read(const byte *key, uint key_len, byte *buf);
|
int pk_read(const byte *key, uint key_len, byte *buf);
|
||||||
int complemented_pk_read(const byte *old_data, byte *new_data);
|
int complemented_pk_read(const byte *old_data, byte *new_data);
|
||||||
int peek_row();
|
int peek_row();
|
||||||
|
@ -970,8 +970,10 @@ int handler::read_first_row(byte * buf, uint primary_key)
|
|||||||
/*
|
/*
|
||||||
If there is very few deleted rows in the table, find the first row by
|
If there is very few deleted rows in the table, find the first row by
|
||||||
scanning the table.
|
scanning the table.
|
||||||
|
TODO remove the test for HA_READ_ORDER
|
||||||
*/
|
*/
|
||||||
if (deleted < 10 || primary_key >= MAX_KEY)
|
if (deleted < 10 || primary_key >= MAX_KEY ||
|
||||||
|
!(index_flags(primary_key, 0, 0) & HA_READ_ORDER))
|
||||||
{
|
{
|
||||||
(void) ha_rnd_init(1);
|
(void) ha_rnd_init(1);
|
||||||
while ((error= rnd_next(buf)) == HA_ERR_RECORD_DELETED) ;
|
while ((error= rnd_next(buf)) == HA_ERR_RECORD_DELETED) ;
|
||||||
|
10
sql/item.h
10
sql/item.h
@ -266,6 +266,14 @@ public:
|
|||||||
virtual bool get_time(TIME *ltime);
|
virtual bool get_time(TIME *ltime);
|
||||||
virtual bool get_date_result(TIME *ltime,uint fuzzydate)
|
virtual bool get_date_result(TIME *ltime,uint fuzzydate)
|
||||||
{ return get_date(ltime,fuzzydate); }
|
{ return get_date(ltime,fuzzydate); }
|
||||||
|
/*
|
||||||
|
This function is used only in Item_func_isnull/Item_func_isnotnull
|
||||||
|
(implementations of IS NULL/IS NOT NULL clauses). Item_func_is{not}null
|
||||||
|
calls this method instead of one of val/result*() methods, which
|
||||||
|
normally will set null_value. This allows to determine nullness of
|
||||||
|
a complex expression without fully evaluating it.
|
||||||
|
Any new item which can be NULL must implement this call.
|
||||||
|
*/
|
||||||
virtual bool is_null() { return 0; }
|
virtual bool is_null() { return 0; }
|
||||||
/*
|
/*
|
||||||
it is "top level" item of WHERE clause and we do not need correct NULL
|
it is "top level" item of WHERE clause and we do not need correct NULL
|
||||||
@ -710,6 +718,8 @@ public:
|
|||||||
void print(String *str);
|
void print(String *str);
|
||||||
/* parameter never equal to other parameter of other item */
|
/* parameter never equal to other parameter of other item */
|
||||||
bool eq(const Item *item, bool binary_cmp) const { return 0; }
|
bool eq(const Item *item, bool binary_cmp) const { return 0; }
|
||||||
|
bool is_null()
|
||||||
|
{ DBUG_ASSERT(state != NO_VALUE); return state == NULL_VALUE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Item_int :public Item_num
|
class Item_int :public Item_num
|
||||||
|
@ -2429,11 +2429,12 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
int error;
|
int error;
|
||||||
if ((error=regcomp(&preg,res->c_ptr(),
|
if ((error= regcomp(&preg,res->c_ptr(),
|
||||||
(cmp_collation.collation->state & MY_CS_BINSORT) ?
|
((cmp_collation.collation->state & MY_CS_BINSORT) ||
|
||||||
REG_EXTENDED | REG_NOSUB :
|
(cmp_collation.collation->state & MY_CS_CSSORT)) ?
|
||||||
REG_EXTENDED | REG_NOSUB | REG_ICASE,
|
REG_EXTENDED | REG_NOSUB :
|
||||||
cmp_collation.collation)))
|
REG_EXTENDED | REG_NOSUB | REG_ICASE,
|
||||||
|
cmp_collation.collation)))
|
||||||
{
|
{
|
||||||
(void) regerror(error,&preg,buff,sizeof(buff));
|
(void) regerror(error,&preg,buff,sizeof(buff));
|
||||||
my_error(ER_REGEXP_ERROR, MYF(0), buff);
|
my_error(ER_REGEXP_ERROR, MYF(0), buff);
|
||||||
@ -2481,10 +2482,11 @@ longlong Item_func_regex::val_int()
|
|||||||
regex_compiled=0;
|
regex_compiled=0;
|
||||||
}
|
}
|
||||||
if (regcomp(&preg,res2->c_ptr(),
|
if (regcomp(&preg,res2->c_ptr(),
|
||||||
(cmp_collation.collation->state & MY_CS_BINSORT) ?
|
((cmp_collation.collation->state & MY_CS_BINSORT) ||
|
||||||
REG_EXTENDED | REG_NOSUB :
|
(cmp_collation.collation->state & MY_CS_CSSORT)) ?
|
||||||
REG_EXTENDED | REG_NOSUB | REG_ICASE,
|
REG_EXTENDED | REG_NOSUB :
|
||||||
cmp_collation.collation))
|
REG_EXTENDED | REG_NOSUB | REG_ICASE,
|
||||||
|
cmp_collation.collation))
|
||||||
{
|
{
|
||||||
null_value=1;
|
null_value=1;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2781,13 +2781,18 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list)
|
|||||||
while ((var=it++))
|
while ((var=it++))
|
||||||
{
|
{
|
||||||
if ((error=var->check(thd)))
|
if ((error=var->check(thd)))
|
||||||
DBUG_RETURN(error);
|
goto err;
|
||||||
}
|
}
|
||||||
if (thd->net.report_error)
|
if (!thd->net.report_error)
|
||||||
DBUG_RETURN(1);
|
{
|
||||||
it.rewind();
|
it.rewind();
|
||||||
while ((var=it++))
|
while ((var= it++))
|
||||||
error|= var->update(thd); // Returns 0, -1 or 1
|
error|= var->update(thd); // Returns 0, -1 or 1
|
||||||
|
}
|
||||||
|
else
|
||||||
|
error= 1;
|
||||||
|
err:
|
||||||
|
free_underlaid_joins(thd, &thd->lex->select_lex);
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ bool mysql_do(THD *thd, List<Item> &values)
|
|||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
while ((value = li++))
|
while ((value = li++))
|
||||||
value->val_int();
|
value->val_int();
|
||||||
|
free_underlaid_joins(thd, &thd->lex->select_lex);
|
||||||
thd->clear_error(); // DO always is OK
|
thd->clear_error(); // DO always is OK
|
||||||
send_ok(thd);
|
send_ok(thd);
|
||||||
DBUG_RETURN(FALSE);
|
DBUG_RETURN(FALSE);
|
||||||
|
@ -2626,7 +2626,7 @@ add_key_field(KEY_FIELD **key_fields, uint and_level, COND *cond,
|
|||||||
|
|
||||||
bool is_const=1;
|
bool is_const=1;
|
||||||
for (uint i=0; i<num_values; i++)
|
for (uint i=0; i<num_values; i++)
|
||||||
is_const&= (value[i])->const_item();
|
is_const&= value[i]->const_item();
|
||||||
if (is_const)
|
if (is_const)
|
||||||
stat[0].const_keys.merge(possible_keys);
|
stat[0].const_keys.merge(possible_keys);
|
||||||
/*
|
/*
|
||||||
|
@ -835,7 +835,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
List_iterator<key_part_spec> cols(key->columns);
|
List_iterator<key_part_spec> cols(key->columns), cols2(key->columns);
|
||||||
CHARSET_INFO *ft_key_charset=0; // for FULLTEXT
|
CHARSET_INFO *ft_key_charset=0; // for FULLTEXT
|
||||||
for (uint column_nr=0 ; (column=cols++) ; column_nr++)
|
for (uint column_nr=0 ; (column=cols++) ; column_nr++)
|
||||||
{
|
{
|
||||||
@ -851,6 +851,19 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name);
|
my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name);
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
}
|
}
|
||||||
|
for (uint dup_nr= 0; dup_nr < column_nr; dup_nr++)
|
||||||
|
{
|
||||||
|
key_part_spec *dup_column= cols2++;
|
||||||
|
if (!my_strcasecmp(system_charset_info,
|
||||||
|
column->field_name, dup_column->field_name))
|
||||||
|
{
|
||||||
|
my_printf_error(ER_DUP_FIELDNAME,
|
||||||
|
ER(ER_DUP_FIELDNAME),MYF(0),
|
||||||
|
column->field_name);
|
||||||
|
DBUG_RETURN(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cols2.rewind();
|
||||||
/* for fulltext keys keyseg length is 1 for blobs (it's ignored in
|
/* for fulltext keys keyseg length is 1 for blobs (it's ignored in
|
||||||
ft code anyway, and 0 (set to column width later) for char's.
|
ft code anyway, and 0 (set to column width later) for char's.
|
||||||
it has to be correct col width for char's, as char data are not
|
it has to be correct col width for char's, as char data are not
|
||||||
|
@ -589,12 +589,12 @@ static MY_COLLATION_HANDLER my_collation_latin2_czech_ci_handler =
|
|||||||
|
|
||||||
CHARSET_INFO my_charset_latin2_czech_ci =
|
CHARSET_INFO my_charset_latin2_czech_ci =
|
||||||
{
|
{
|
||||||
2,0,0, /* number */
|
2,0,0, /* number */
|
||||||
MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */
|
MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT, /* state */
|
||||||
"latin2", /* cs name */
|
"latin2", /* cs name */
|
||||||
"latin2_czech_cs", /* name */
|
"latin2_czech_cs", /* name */
|
||||||
"", /* comment */
|
"", /* comment */
|
||||||
NULL, /* tailoring */
|
NULL, /* tailoring */
|
||||||
ctype_czech,
|
ctype_czech,
|
||||||
to_lower_czech,
|
to_lower_czech,
|
||||||
to_upper_czech,
|
to_upper_czech,
|
||||||
|
@ -624,12 +624,12 @@ static MY_COLLATION_HANDLER my_collation_czech_ci_handler =
|
|||||||
|
|
||||||
CHARSET_INFO my_charset_cp1250_czech_ci =
|
CHARSET_INFO my_charset_cp1250_czech_ci =
|
||||||
{
|
{
|
||||||
34,0,0, /* number */
|
34,0,0, /* number */
|
||||||
MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */
|
MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT, /* state */
|
||||||
"cp1250", /* cs name */
|
"cp1250", /* cs name */
|
||||||
"cp1250_czech_cs", /* name */
|
"cp1250_czech_cs", /* name */
|
||||||
"", /* comment */
|
"", /* comment */
|
||||||
NULL, /* tailoring */
|
NULL, /* tailoring */
|
||||||
ctype_win1250ch,
|
ctype_win1250ch,
|
||||||
to_lower_win1250ch,
|
to_lower_win1250ch,
|
||||||
to_upper_win1250ch,
|
to_upper_win1250ch,
|
||||||
|
@ -23,13 +23,14 @@ struct uca_item_st
|
|||||||
#define MY_UCA_PSHIFT 8
|
#define MY_UCA_PSHIFT 8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static char *pname[]= {"", "2", "3"};
|
||||||
|
|
||||||
int main(int ac, char **av)
|
int main(int ac, char **av)
|
||||||
{
|
{
|
||||||
char str[256];
|
char str[256];
|
||||||
char *weights[64];
|
char *weights[64];
|
||||||
struct uca_item_st uca[64*1024];
|
struct uca_item_st uca[64*1024];
|
||||||
size_t code, page, w;
|
size_t code, w;
|
||||||
int pagemaxlen[MY_UCA_NPAGES];
|
|
||||||
int pageloaded[MY_UCA_NPAGES];
|
int pageloaded[MY_UCA_NPAGES];
|
||||||
|
|
||||||
bzero(uca, sizeof(uca));
|
bzero(uca, sizeof(uca));
|
||||||
@ -155,14 +156,20 @@ int main(int ac, char **av)
|
|||||||
printf("#define MY_UCA_CMASK %d\n",MY_UCA_CMASK);
|
printf("#define MY_UCA_CMASK %d\n",MY_UCA_CMASK);
|
||||||
printf("#define MY_UCA_PSHIFT %d\n",MY_UCA_PSHIFT);
|
printf("#define MY_UCA_PSHIFT %d\n",MY_UCA_PSHIFT);
|
||||||
|
|
||||||
for (w=0; w<1; w++)
|
for (w=0; w<3; w++)
|
||||||
{
|
{
|
||||||
|
size_t page;
|
||||||
|
int pagemaxlen[MY_UCA_NPAGES];
|
||||||
|
|
||||||
for (page=0; page < MY_UCA_NPAGES; page++)
|
for (page=0; page < MY_UCA_NPAGES; page++)
|
||||||
{
|
{
|
||||||
size_t offs;
|
size_t offs;
|
||||||
size_t maxnum= 0;
|
size_t maxnum= 0;
|
||||||
size_t nchars= 0;
|
size_t nchars= 0;
|
||||||
size_t mchars;
|
size_t mchars;
|
||||||
|
size_t ndefs= 0;
|
||||||
|
|
||||||
|
pagemaxlen[page]= 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Skip this page if no weights were loaded
|
Skip this page if no weights were loaded
|
||||||
@ -183,15 +190,36 @@ int main(int ac, char **av)
|
|||||||
code= page*MY_UCA_NCHARS+offs;
|
code= page*MY_UCA_NCHARS+offs;
|
||||||
|
|
||||||
/* Calculate only non-zero weights */
|
/* Calculate only non-zero weights */
|
||||||
num=0;
|
for (num=0, i=0; i < uca[code].num; i++)
|
||||||
for (i=0; i < uca[code].num; i++)
|
|
||||||
if (uca[code].weight[w][i])
|
if (uca[code].weight[w][i])
|
||||||
num++;
|
num++;
|
||||||
|
|
||||||
maxnum= maxnum < num ? num : maxnum;
|
maxnum= maxnum < num ? num : maxnum;
|
||||||
|
|
||||||
|
/* Check if default weight */
|
||||||
|
if (w == 1 && num == 1)
|
||||||
|
{
|
||||||
|
/* 0020 0000 ... */
|
||||||
|
if (uca[code].weight[w][0] == 0x0020)
|
||||||
|
ndefs++;
|
||||||
|
}
|
||||||
|
else if (w == 2 && num == 1)
|
||||||
|
{
|
||||||
|
/* 0002 0000 ... */
|
||||||
|
if (uca[code].weight[w][0] == 0x0002)
|
||||||
|
ndefs++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
maxnum++;
|
maxnum++;
|
||||||
|
|
||||||
|
/*
|
||||||
|
If the page have only default weights
|
||||||
|
then no needs to dump it, skip.
|
||||||
|
*/
|
||||||
|
if (ndefs == MY_UCA_NCHARS)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
switch (maxnum)
|
switch (maxnum)
|
||||||
{
|
{
|
||||||
case 0: mchars= 8; break;
|
case 0: mchars= 8; break;
|
||||||
@ -210,8 +238,8 @@ int main(int ac, char **av)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
printf("uint16 page%03Xdata[]= { /* %04X (%d weights per char) */\n",
|
printf("uint16 page%03Xdata%s[]= { /* %04X (%d weights per char) */\n",
|
||||||
page, page*MY_UCA_NCHARS, maxnum);
|
page, pname[w], page*MY_UCA_NCHARS, maxnum);
|
||||||
|
|
||||||
for (offs=0; offs < MY_UCA_NCHARS; offs++)
|
for (offs=0; offs < MY_UCA_NCHARS; offs++)
|
||||||
{
|
{
|
||||||
@ -234,7 +262,17 @@ int main(int ac, char **av)
|
|||||||
|
|
||||||
for (i=0; i < maxnum; i++)
|
for (i=0; i < maxnum; i++)
|
||||||
{
|
{
|
||||||
printf("0x%04X",(int)weight[i]);
|
/*
|
||||||
|
Invert weights for secondary level to
|
||||||
|
sort upper case letters before their
|
||||||
|
lower case counter part.
|
||||||
|
*/
|
||||||
|
int tmp= weight[i];
|
||||||
|
if (w == 2 && tmp)
|
||||||
|
tmp= (int)(0x100 - weight[i]);
|
||||||
|
|
||||||
|
|
||||||
|
printf("0x%04X", tmp);
|
||||||
if ((offs+1 != MY_UCA_NCHARS) || (i+1!=maxnum))
|
if ((offs+1 != MY_UCA_NCHARS) || (i+1!=maxnum))
|
||||||
printf(",");
|
printf(",");
|
||||||
nchars++;
|
nchars++;
|
||||||
@ -251,25 +289,28 @@ int main(int ac, char **av)
|
|||||||
}
|
}
|
||||||
printf("};\n\n");
|
printf("};\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("uchar uca_length%s[%d]={\n", pname[w], MY_UCA_NPAGES);
|
||||||
|
for (page=0; page < MY_UCA_NPAGES; page++)
|
||||||
|
{
|
||||||
|
printf("%d%s%s",pagemaxlen[page],page<MY_UCA_NPAGES-1?",":"",(page+1) % 16 ? "":"\n");
|
||||||
|
}
|
||||||
|
printf("};\n");
|
||||||
|
|
||||||
|
|
||||||
|
printf("uint16 *uca_weight%s[%d]={\n", pname[w], MY_UCA_NPAGES);
|
||||||
|
for (page=0; page < MY_UCA_NPAGES; page++)
|
||||||
|
{
|
||||||
|
const char *comma= page < MY_UCA_NPAGES-1 ? "," : "";
|
||||||
|
const char *nline= (page+1) % 4 ? "" : "\n";
|
||||||
|
if (!pagemaxlen[page])
|
||||||
|
printf("NULL %s%s", comma , nline);
|
||||||
|
else
|
||||||
|
printf("page%03Xdata%s%s%s", page, pname[w], comma, nline);
|
||||||
|
}
|
||||||
|
printf("};\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("uchar ucal[%d]={\n",MY_UCA_NPAGES);
|
|
||||||
for (page=0; page < MY_UCA_NPAGES; page++)
|
|
||||||
{
|
|
||||||
printf("%d%s%s",pagemaxlen[page],page<MY_UCA_NPAGES-1?",":"",(page+1) % 16 ? "":"\n");
|
|
||||||
}
|
|
||||||
printf("};\n");
|
|
||||||
|
|
||||||
|
|
||||||
printf("uint16 *ucaw[%d]={\n",MY_UCA_NPAGES);
|
|
||||||
for (page=0; page < MY_UCA_NPAGES; page++)
|
|
||||||
{
|
|
||||||
if (!pageloaded[page])
|
|
||||||
printf("NULL %s%s",page<MY_UCA_NPAGES-1?",":"", (page+1) % 4 ? "":"\n");
|
|
||||||
else
|
|
||||||
printf("page%03Xdata%s%s",page,page<MY_UCA_NPAGES-1?",":"", (page+1) % 4 ? "":"\n");
|
|
||||||
}
|
|
||||||
printf("};\n");
|
|
||||||
|
|
||||||
printf("int main(void){ return 0;};\n");
|
printf("int main(void){ return 0;};\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user