Commit 2c16ccdb authored by pem@mysql.com's avatar pem@mysql.com

Merge mysql.com:/home/pem/work/mysql-4.1

into mysql.com:/home/pem/work/mysql-5.0
parents e282c8cc 1be4a37f
...@@ -14,3 +14,16 @@ drop table t1; ...@@ -14,3 +14,16 @@ drop table t1;
create table t1 (a int null); create table t1 (a int null);
insert into t1 values (1),(NULL); insert into t1 values (1),(NULL);
drop table t1; drop table t1;
create table t1 (a int null);
alter table t1 add constraint constraint_1 unique (a);
alter table t1 add constraint unique key_1(a);
alter table t1 add constraint constraint_2 unique key_2(a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) default NULL,
UNIQUE KEY `constraint_1` (`a`),
UNIQUE KEY `key_1` (`a`),
UNIQUE KEY `key_2` (`a`)
) TYPE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
...@@ -21,3 +21,9 @@ drop table t1; ...@@ -21,3 +21,9 @@ drop table t1;
create table t1 (a int null); create table t1 (a int null);
insert into t1 values (1),(NULL); insert into t1 values (1),(NULL);
drop table t1; drop table t1;
create table t1 (a int null);
alter table t1 add constraint constraint_1 unique (a);
alter table t1 add constraint unique key_1(a);
alter table t1 add constraint constraint_2 unique key_2(a);
show create table t1;
drop table t1;
...@@ -599,8 +599,7 @@ int Item_param::save_in_field(Field *field, bool no_conversions) ...@@ -599,8 +599,7 @@ int Item_param::save_in_field(Field *field, bool no_conversions)
{ {
THD *thd= current_thd; THD *thd= current_thd;
if (thd->command == COM_PREPARE) DBUG_ASSERT(thd->command == COM_EXECUTE);
return -1;
if (null_value) if (null_value)
return (int) set_field_to_null(field); return (int) set_field_to_null(field);
......
...@@ -672,8 +672,6 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables, ...@@ -672,8 +672,6 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
fix_tables_pointers(thd->lex->all_selects_list); fix_tables_pointers(thd->lex->all_selects_list);
if (!result && !(result= new select_send())) if (!result && !(result= new select_send()))
{ {
delete select_lex->having;
delete select_lex->where;
send_error(thd, ER_OUT_OF_RESOURCES); send_error(thd, ER_OUT_OF_RESOURCES);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -681,10 +679,10 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables, ...@@ -681,10 +679,10 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
JOIN *join= new JOIN(thd, fields, select_options, result); JOIN *join= new JOIN(thd, fields, select_options, result);
thd->used_tables= 0; // Updated by setup_fields thd->used_tables= 0; // Updated by setup_fields
if (join->prepare(&select_lex->ref_pointer_array, tables, if (join->prepare(&select_lex->ref_pointer_array, tables,
wild_num, conds, og_num, order, group, having, proc, wild_num, conds, og_num, order, group, having, proc,
select_lex, unit)) select_lex, unit))
DBUG_RETURN(1); DBUG_RETURN(1);
if (send_prep_stmt(stmt, fields.elements) || if (send_prep_stmt(stmt, fields.elements) ||
thd->protocol_simple.send_fields(&fields, 0) || thd->protocol_simple.send_fields(&fields, 0) ||
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
......
...@@ -1611,10 +1611,6 @@ mysql_select(THD *thd, Item ***rref_pointer_array, ...@@ -1611,10 +1611,6 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
err: err:
if (free_join) if (free_join)
{ {
JOIN *curr_join= (join->need_tmp&&join->tmp_join?
(join->tmp_join->error=join->error,join->tmp_join):
join);
thd->proc_info="end"; thd->proc_info="end";
err= join->cleanup(); err= join->cleanup();
if (thd->net.report_error) if (thd->net.report_error)
......
...@@ -636,7 +636,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -636,7 +636,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%type <simple_string> %type <simple_string>
remember_name remember_end opt_ident opt_db text_or_password remember_name remember_end opt_ident opt_db text_or_password
opt_escape opt_escape opt_constraint
%type <string> %type <string>
text_string opt_gconcat_separator text_string opt_gconcat_separator
...@@ -670,7 +670,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -670,7 +670,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
ident_list ident_list_arg ident_list ident_list_arg
%type <key_type> %type <key_type>
key_type opt_unique_or_fulltext key_type opt_unique_or_fulltext constraint_key_type
%type <key_alg> %type <key_alg>
key_alg opt_btree_or_rtree key_alg opt_btree_or_rtree
...@@ -2144,6 +2144,13 @@ key_def: ...@@ -2144,6 +2144,13 @@ key_def:
lex->key_list.push_back(new Key($1,$2, $3, lex->col_list)); lex->key_list.push_back(new Key($1,$2, $3, lex->col_list));
lex->col_list.empty(); /* Alloced by sql_alloc */ lex->col_list.empty(); /* Alloced by sql_alloc */
} }
| opt_constraint constraint_key_type opt_ident key_alg '(' key_list ')'
{
LEX *lex=Lex;
const char *key_name= $3 ? $3:$1;
lex->key_list.push_back(new Key($2, key_name, $4, lex->col_list));
lex->col_list.empty(); /* Alloced by sql_alloc */
}
| opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references | opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
{ {
LEX *lex=Lex; LEX *lex=Lex;
...@@ -2167,8 +2174,8 @@ check_constraint: ...@@ -2167,8 +2174,8 @@ check_constraint:
; ;
opt_constraint: opt_constraint:
/* empty */ /* empty */ { $$=(char*) 0; }
| CONSTRAINT opt_ident; | CONSTRAINT opt_ident { $$=$2; };
field_spec: field_spec:
field_ident field_ident
...@@ -2530,14 +2537,16 @@ delete_option: ...@@ -2530,14 +2537,16 @@ delete_option:
| SET DEFAULT { $$= (int) foreign_key::FK_OPTION_DEFAULT; }; | SET DEFAULT { $$= (int) foreign_key::FK_OPTION_DEFAULT; };
key_type: key_type:
opt_constraint PRIMARY_SYM KEY_SYM { $$= Key::PRIMARY; } key_or_index { $$= Key::MULTIPLE; }
| key_or_index { $$= Key::MULTIPLE; }
| FULLTEXT_SYM { $$= Key::FULLTEXT; } | FULLTEXT_SYM { $$= Key::FULLTEXT; }
| FULLTEXT_SYM key_or_index { $$= Key::FULLTEXT; } | FULLTEXT_SYM key_or_index { $$= Key::FULLTEXT; }
| SPATIAL_SYM { $$= Key::SPATIAL; } | SPATIAL_SYM { $$= Key::SPATIAL; }
| SPATIAL_SYM key_or_index { $$= Key::SPATIAL; } | SPATIAL_SYM key_or_index { $$= Key::SPATIAL; };
| opt_constraint UNIQUE_SYM { $$= Key::UNIQUE; }
| opt_constraint UNIQUE_SYM key_or_index { $$= Key::UNIQUE; }; constraint_key_type:
PRIMARY_SYM KEY_SYM { $$= Key::PRIMARY; }
| UNIQUE_SYM { $$= Key::UNIQUE; }
| UNIQUE_SYM key_or_index { $$= Key::UNIQUE; };
key_or_index: key_or_index:
KEY_SYM {} KEY_SYM {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment