mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 18:20:07 +01:00
parent
7455759f11
commit
2d120d32fa
10 changed files with 68 additions and 10 deletions
|
@ -1151,3 +1151,28 @@ INSERT INTO t1 VALUES (1,0,NULL,NULL),(2,0,NULL,NULL);
|
|||
SELECT DISTINCT REF_ID FROM t1 WHERE ID= (SELECT DISTINCT REF_ID FROM t1 WHERE ID=2);
|
||||
REF_ID
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1
|
||||
(
|
||||
FOLDERID VARCHAR(32)BINARY NOT NULL
|
||||
, FOLDERNAME VARCHAR(255)BINARY NOT NULL
|
||||
, CREATOR VARCHAR(255)BINARY
|
||||
, CREATED TIMESTAMP NOT NULL
|
||||
, DESCRIPTION VARCHAR(255)BINARY
|
||||
, FOLDERTYPE INTEGER NOT NULL
|
||||
, MODIFIED TIMESTAMP
|
||||
, MODIFIER VARCHAR(255)BINARY
|
||||
, FOLDERSIZE INTEGER NOT NULL
|
||||
, PARENTID VARCHAR(32)BINARY
|
||||
, REPID VARCHAR(32)BINARY
|
||||
, ORIGINATOR INTEGER
|
||||
, PRIMARY KEY ( FOLDERID )
|
||||
) TYPE=InnoDB;
|
||||
CREATE INDEX FFOLDERID_IDX ON t1 (FOLDERID);
|
||||
CREATE INDEX CMFLDRPARNT_IDX ON t1 (PARENTID);
|
||||
INSERT INTO t1 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1");
|
||||
INSERT INTO t1 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", "2003-06-09 10:52:02", "The default content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "03eea05112b845949f3fd03278b5fe43", "1");
|
||||
INSERT INTO t1 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
|
||||
SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1');
|
||||
'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1')
|
||||
0
|
||||
drop table t1;
|
||||
|
|
|
@ -732,3 +732,31 @@ CREATE TABLE t1 (
|
|||
INSERT INTO t1 VALUES (1,0,NULL,NULL),(2,0,NULL,NULL);
|
||||
SELECT DISTINCT REF_ID FROM t1 WHERE ID= (SELECT DISTINCT REF_ID FROM t1 WHERE ID=2);
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# key field overflow test
|
||||
#
|
||||
CREATE TABLE t1
|
||||
(
|
||||
FOLDERID VARCHAR(32)BINARY NOT NULL
|
||||
, FOLDERNAME VARCHAR(255)BINARY NOT NULL
|
||||
, CREATOR VARCHAR(255)BINARY
|
||||
, CREATED TIMESTAMP NOT NULL
|
||||
, DESCRIPTION VARCHAR(255)BINARY
|
||||
, FOLDERTYPE INTEGER NOT NULL
|
||||
, MODIFIED TIMESTAMP
|
||||
, MODIFIER VARCHAR(255)BINARY
|
||||
, FOLDERSIZE INTEGER NOT NULL
|
||||
, PARENTID VARCHAR(32)BINARY
|
||||
, REPID VARCHAR(32)BINARY
|
||||
, ORIGINATOR INTEGER
|
||||
|
||||
, PRIMARY KEY ( FOLDERID )
|
||||
) TYPE=InnoDB;
|
||||
CREATE INDEX FFOLDERID_IDX ON t1 (FOLDERID);
|
||||
CREATE INDEX CMFLDRPARNT_IDX ON t1 (PARENTID);
|
||||
INSERT INTO t1 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1");
|
||||
INSERT INTO t1 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", "2003-06-09 10:52:02", "The default content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "03eea05112b845949f3fd03278b5fe43", "1");
|
||||
INSERT INTO t1 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
|
||||
SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1');
|
||||
drop table t1;
|
||||
|
|
|
@ -1638,7 +1638,7 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
maybe_null=1;
|
||||
}
|
||||
if (thd)
|
||||
thd->cond_count+=list.elements;
|
||||
thd->lex.current_select->cond_count+=list.elements;
|
||||
fix_length_and_dec();
|
||||
fixed= 1;
|
||||
return 0;
|
||||
|
|
|
@ -824,6 +824,8 @@ int subselect_single_select_engine::exec()
|
|||
{
|
||||
DBUG_ENTER("subselect_single_select_engine::exec");
|
||||
char const *save_where= join->thd->where;
|
||||
SELECT_LEX_NODE *save_select= join->thd->lex.current_select;
|
||||
join->thd->lex.current_select= select_lex;
|
||||
if (!optimized)
|
||||
{
|
||||
optimized=1;
|
||||
|
@ -831,6 +833,7 @@ int subselect_single_select_engine::exec()
|
|||
{
|
||||
join->thd->where= save_where;
|
||||
executed= 1;
|
||||
join->thd->lex.current_select= save_select;
|
||||
DBUG_RETURN(join->error?join->error:1);
|
||||
}
|
||||
}
|
||||
|
@ -839,6 +842,7 @@ int subselect_single_select_engine::exec()
|
|||
if (join->reinit())
|
||||
{
|
||||
join->thd->where= save_where;
|
||||
join->thd->lex.current_select= save_select;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
item->reset();
|
||||
|
@ -846,15 +850,14 @@ int subselect_single_select_engine::exec()
|
|||
}
|
||||
if (!executed)
|
||||
{
|
||||
SELECT_LEX_NODE *save_select= join->thd->lex.current_select;
|
||||
join->thd->lex.current_select= select_lex;
|
||||
join->exec();
|
||||
join->thd->lex.current_select= save_select;
|
||||
executed= 1;
|
||||
join->thd->where= save_where;
|
||||
join->thd->lex.current_select= save_select;
|
||||
DBUG_RETURN(join->error||thd->is_fatal_error);
|
||||
}
|
||||
join->thd->where= save_where;
|
||||
join->thd->lex.current_select= save_select;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2151,7 +2151,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
|
|||
DBUG_ENTER("setup_conds");
|
||||
thd->set_query_id=1;
|
||||
|
||||
thd->cond_count= 0;
|
||||
thd->lex.current_select->cond_count= 0;
|
||||
if (*conds)
|
||||
{
|
||||
thd->where="where clause";
|
||||
|
@ -2169,7 +2169,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
|
|||
if (table->on_expr->fix_fields(thd, tables, &table->on_expr) ||
|
||||
table->on_expr->check_cols(1))
|
||||
DBUG_RETURN(1);
|
||||
thd->cond_count++;
|
||||
thd->lex.current_select->cond_count++;
|
||||
|
||||
/* If it's a normal join, add the ON/USING expression to the WHERE */
|
||||
if (!table->outer_join)
|
||||
|
@ -2215,7 +2215,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
|
|||
}
|
||||
}
|
||||
cond_and->used_tables_cache= t1->map | t2->map;
|
||||
thd->cond_count+=cond_and->list.elements;
|
||||
thd->lex.current_select->cond_count+=cond_and->list.elements;
|
||||
if (!table->outer_join) // Not left join
|
||||
{
|
||||
if (!(*conds=and_conds(*conds, cond_and)))
|
||||
|
|
|
@ -107,7 +107,6 @@ THD::THD():user_time(0), is_fatal_error(0),
|
|||
slave_thread = 0;
|
||||
variables.pseudo_thread_id= 0;
|
||||
file_id = 0;
|
||||
cond_count=0;
|
||||
warn_id= 0;
|
||||
db_charset= global_system_variables.character_set_database;
|
||||
mysys_var=0;
|
||||
|
|
|
@ -520,7 +520,7 @@ public:
|
|||
ulong row_count; // Row counter, mainly for errors and warnings
|
||||
long dbug_thread_id;
|
||||
pthread_t real_id;
|
||||
uint current_tablenr,tmp_table,cond_count;
|
||||
uint current_tablenr,tmp_table;
|
||||
uint server_status,open_options;
|
||||
uint32 query_length;
|
||||
uint32 db_length;
|
||||
|
|
|
@ -967,6 +967,7 @@ void st_select_lex_node::init_query()
|
|||
linkage= UNSPECIFIED_TYPE;
|
||||
no_table_names_allowed= uncacheable= dependent= 0;
|
||||
ref_pointer_array= 0;
|
||||
cond_count= 0;
|
||||
}
|
||||
|
||||
void st_select_lex_node::init_select()
|
||||
|
|
|
@ -207,6 +207,7 @@ public:
|
|||
Item **ref_pointer_array;
|
||||
|
||||
uint select_items; /* number of items in select_list */
|
||||
uint cond_count; /* number of arguments of and/or/xor in where/having */
|
||||
enum_parsing_place parsing_place; /* where we are parsing expression */
|
||||
bool with_sum_func; /* sum function indicator */
|
||||
bool dependent; /* dependent from outer select subselect */
|
||||
|
|
|
@ -2156,7 +2156,8 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
|
|||
KEY_FIELD *key_fields,*end;
|
||||
|
||||
if (!(key_fields=(KEY_FIELD*)
|
||||
thd->alloc(sizeof(key_fields[0])*(thd->cond_count+1)*2)))
|
||||
thd->alloc(sizeof(key_fields[0])*
|
||||
(thd->lex.current_select->cond_count+1)*2)))
|
||||
return TRUE; /* purecov: inspected */
|
||||
and_level=0; end=key_fields;
|
||||
if (cond)
|
||||
|
|
Loading…
Add table
Reference in a new issue