Commit dafaf14c authored by unknown's avatar unknown

Merge mysql.com:/usr/local/bk/mysql-5.0

into mysql.com:/home/pem/work/mysql-5.0
parents de752b52 3ef6f2aa
......@@ -333,4 +333,5 @@
#define ER_SP_DUP_COND 1314
#define ER_SP_DUP_CURS 1315
#define ER_SP_CANT_ALTER 1316
#define ER_ERROR_MESSAGES 317
#define ER_SP_SUBSELECT_NYI 1317
#define ER_ERROR_MESSAGES 318
......@@ -194,3 +194,4 @@ ER_SP_DUP_VAR, "42000", "",
ER_SP_DUP_COND, "42000", "",
ER_SP_DUP_CURS, "42000", "",
/*ER_SP_CANT_ALTER*/
ER_SP_SUBSELECT_NYI, "0A000", "",
......@@ -270,4 +270,14 @@ ERROR 42S22: Unknown column 'valname' in 'order clause'
drop procedure bug1965;
select 1 into a;
ERROR 42000: Undeclared variable: a
create procedure bug336(id char(16))
begin
declare x int;
set x = (select sum(t.data) from test.t2 t);
end;
ERROR 0A000: Subselect value not supported
create function bug1654()
returns int
return (select sum(t.data) from test.t2 t);
ERROR 0A000: Statements like SELECT, INSERT, UPDATE (and others) are not allowed in a FUNCTION
drop table t1;
......@@ -361,6 +361,23 @@ drop procedure bug1965|
--error 1309
select 1 into a|
#
# BUG#336
#
--error 1317
create procedure bug336(id char(16))
begin
declare x int;
set x = (select sum(t.data) from test.t2 t);
end|
#
# BUG#1654
#
--error 1296
create function bug1654()
returns int
return (select sum(t.data) from test.t2 t)|
drop table t1|
......
......@@ -240,6 +240,17 @@ Item_splocal::this_const_item() const
return thd->spcont->get_item(m_offset);
}
Item::Type
Item_splocal::type() const
{
THD *thd= current_thd;
if (thd->spcont)
return thd->spcont->get_item(m_offset)->type();
return NULL_ITEM; // Anything but SUBSELECT_ITEM
}
bool DTCollation::aggregate(DTCollation &dt)
{
if (!my_charset_same(collation, dt.collation))
......
......@@ -260,10 +260,7 @@ class Item_splocal : public Item
// Abstract methods inherited from Item. Just defer the call to
// the item in the frame
inline enum Type type() const
{
return this_const_item()->type();
}
enum Type type() const;
inline double val()
{
......
......@@ -329,3 +329,4 @@ character-set=latin2
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -323,3 +323,4 @@ character-set=latin1
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -331,3 +331,4 @@ character-set=latin1
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -320,3 +320,4 @@ character-set=latin1
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -325,3 +325,4 @@ character-set=latin7
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -320,3 +320,4 @@ character-set=latin1
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -332,3 +332,4 @@ character-set=latin1
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -320,3 +320,4 @@ character-set=greek
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -322,3 +322,4 @@ character-set=latin2
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -320,3 +320,4 @@ character-set=latin1
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -322,3 +322,4 @@ character-set=ujis
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -320,3 +320,4 @@ character-set=euckr
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -322,3 +322,4 @@ character-set=latin1
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -322,3 +322,4 @@ character-set=latin1
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -324,3 +324,4 @@ character-set=latin2
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -321,3 +321,4 @@ character-set=latin1
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -324,3 +324,4 @@ character-set=latin2
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -322,3 +322,4 @@ character-set=koi8r
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -315,3 +315,4 @@ character-set=cp1250
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -328,3 +328,4 @@ character-set=latin2
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -322,3 +322,4 @@ character-set=latin1
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -320,3 +320,4 @@ character-set=latin1
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -325,3 +325,4 @@ character-set=koi8u
"Duplicate condition: %s"
"Duplicate cursor: %s"
"Failed to ALTER %s %s"
"Subselect value not supported"
......@@ -714,6 +714,7 @@ sp_instr_stmt::exec_stmt(THD *thd, LEX *lex)
{
LEX *olex; // The other lex
Item *freelist;
SELECT_LEX *sl;
int res;
olex= thd->lex; // Save the other lex
......@@ -726,7 +727,7 @@ sp_instr_stmt::exec_stmt(THD *thd, LEX *lex)
// Copy WHERE clause pointers to avoid damaging by optimisation
// Also clear ref_pointer_arrays.
for (SELECT_LEX *sl= lex->all_selects_list ;
for (sl= lex->all_selects_list ;
sl ;
sl= sl->next_select_in_list())
{
......@@ -772,7 +773,7 @@ sp_instr_stmt::exec_stmt(THD *thd, LEX *lex)
close_thread_tables(thd); /* Free tables */
}
for (SELECT_LEX *sl= lex->all_selects_list ;
for (sl= lex->all_selects_list ;
sl ;
sl= sl->next_select_in_list())
{
......
......@@ -1548,10 +1548,15 @@ sp_proc_stmt:
}
else
{
sp_instr_freturn *i=
new sp_instr_freturn(lex->sphead->instructions(),
$2, lex->sphead->m_returns);
sp_instr_freturn *i;
if ($2->type() == Item::SUBSELECT_ITEM)
{ /* QQ For now, just disallow subselects as values */
send_error(lex->thd, ER_SP_BADSTATEMENT);
YYABORT;
}
i= new sp_instr_freturn(lex->sphead->instructions(),
$2, lex->sphead->m_returns);
lex->sphead->add_instr(i);
lex->sphead->m_has_return= TRUE;
}
......@@ -5933,6 +5938,11 @@ option_value:
}
else
{ /* An SP local variable */
if ($3 && $3->type() == Item::SUBSELECT_ITEM)
{ /* QQ For now, just disallow subselects as values */
send_error(lex->thd, ER_SP_SUBSELECT_NYI);
YYABORT;
}
sp_pvar_t *spv= lex->spcont->find_pvar(&$1.base_name);
sp_instr_set *i= new sp_instr_set(lex->sphead->instructions(),
spv->offset, $3, spv->type);
......
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