Commit 79a46e0b authored by unknown's avatar unknown

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0

into  sanja.is.com.ua:/home/bell/mysql/bk/work-merge1-5.0


configure.in:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/t/query_cache.test:
  Auto merged
sql/sql_cache.cc:
  merge
parents aae5fed3 4fc48f31
......@@ -4070,4 +4070,33 @@ a
3
drop procedure bug14304|
drop table t3, t4|
drop procedure if exists bug14376|
create procedure bug14376()
begin
declare x int default x;
end|
call bug14376()|
ERROR 42S22: Unknown column 'x' in 'field list'
drop procedure bug14376|
create procedure bug14376()
begin
declare x int default 42;
begin
declare x int default x;
select x;
end;
end|
call bug14376()|
x
42
drop procedure bug14376|
create procedure bug14376(x int)
begin
declare x int default x;
select x;
end|
call bug14376(4711)|
x
4711
drop procedure bug14376|
drop table t1,t2;
......@@ -345,3 +345,16 @@ f1
2000-01-01
2002-02-02
drop table t1;
create table t1 (f1 int);
create table t2 (f2 int);
insert into t1 values(1),(2);
insert into t2 values(1),(1);
update t1,t2 set f1=3,f2=3 where f1=f2 and f1=1;
affected rows: 3
info: Rows matched: 3 Changed: 3 Warnings: 0
update t2 set f2=1;
update t1 set f1=1 where f1=3;
update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
affected rows: 3
info: Rows matched: 3 Changed: 3 Warnings: 0
drop table t1,t2;
......@@ -756,8 +756,6 @@ show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
drop table t1;
#
# SP cursors and selects with query cache (BUG#9715)
#
create table t1 (a int);
......
......@@ -4855,6 +4855,51 @@ call bug14304()|
drop procedure bug14304|
drop table t3, t4|
#
# BUG#14376: MySQL crash on scoped variable (re)initialization
#
--disable_warnings
drop procedure if exists bug14376|
--enable_warnings
create procedure bug14376()
begin
declare x int default x;
end|
# Not the error we want, but that's what we got for now...
--error ER_BAD_FIELD_ERROR
call bug14376()|
drop procedure bug14376|
create procedure bug14376()
begin
declare x int default 42;
begin
declare x int default x;
select x;
end;
end|
call bug14376()|
drop procedure bug14376|
create procedure bug14376(x int)
begin
declare x int default x;
select x;
end|
call bug14376(4711)|
drop procedure bug14376|
#
# BUG#NNNN: New bug synopsis
#
......
......@@ -270,4 +270,21 @@ insert into t1 values('2000-01-01'),('0000-00-00');
update t1 set f1='2002-02-02' where f1 is null;
select * from t1;
drop table t1;
#
# Bug#15028 Multitable update returns different numbers of matched rows
# depending on table order
create table t1 (f1 int);
create table t2 (f2 int);
insert into t1 values(1),(2);
insert into t2 values(1),(1);
--enable_info
update t1,t2 set f1=3,f2=3 where f1=f2 and f1=1;
--disable_info
update t2 set f2=1;
update t1 set f1=1 where f1=3;
--enable_info
update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
--disable_info
drop table t1,t2;
# End of 4.1 tests
......@@ -886,13 +886,17 @@ Backup::checkNodeFail(Signal* signal,
pos= &ref->nodeId - signal->getDataPtr();
break;
}
case GSN_WAIT_GCP_REQ:
case GSN_DROP_TRIG_REQ:
case GSN_CREATE_TRIG_REQ:
case GSN_ALTER_TRIG_REQ:
case GSN_WAIT_GCP_REQ:
ptr.p->setErrorCode(AbortBackupOrd::BackupFailureDueToNodeFail);
return;
case GSN_UTIL_SEQUENCE_REQ:
case GSN_UTIL_LOCK_REQ:
case GSN_DROP_TRIG_REQ:
return;
default:
ndbrequire(false);
}
for(Uint32 i = 0; (i = mask.find(i+1)) != NdbNodeBitmask::NotFound; )
......@@ -1903,7 +1907,7 @@ Backup::execBACKUP_FRAGMENT_CONF(Signal* signal)
const Uint32 nodeId = refToNode(signal->senderBlockRef());
const Uint32 noOfBytes = conf->noOfBytes;
const Uint32 noOfRecords = conf->noOfRecords;
BackupRecordPtr ptr;
c_backupPool.getPtr(ptr, ptrI);
......@@ -1980,7 +1984,7 @@ Backup::execBACKUP_FRAGMENT_REF(Signal* signal)
}
}
}
ndbrequire(false);
goto err;
done:
ptr.p->masterData.sendCounter--;
......@@ -1992,7 +1996,8 @@ Backup::execBACKUP_FRAGMENT_REF(Signal* signal)
masterAbort(signal, ptr);
return;
}//if
err:
AbortBackupOrd *ord = (AbortBackupOrd*)signal->getDataPtrSend();
ord->backupId = ptr.p->backupId;
ord->backupPtr = ptr.i;
......
......@@ -52,7 +52,7 @@ sp_cond_check(LEX_STRING *sqlstate)
sp_pcontext::sp_pcontext(sp_pcontext *prev)
: Sql_alloc(), m_psubsize(0), m_csubsize(0), m_hsubsize(0),
m_handlers(0), m_parent(prev)
m_handlers(0), m_parent(prev), m_pboundary(0)
{
VOID(my_init_dynamic_array(&m_pvar, sizeof(sp_pvar_t *), 16, 8));
VOID(my_init_dynamic_array(&m_cond, sizeof(sp_cond_type_t *), 16, 8));
......@@ -150,7 +150,7 @@ sp_pcontext::diff_cursors(sp_pcontext *ctx)
sp_pvar_t *
sp_pcontext::find_pvar(LEX_STRING *name, my_bool scoped)
{
uint i= m_pvar.elements;
uint i= m_pvar.elements - m_pboundary;
while (i--)
{
......
......@@ -174,6 +174,16 @@ class sp_pcontext : public Sql_alloc
sp_pvar_t *
find_pvar(uint offset);
/*
Set the current scope boundary (for default values)
The argument is the number of variables to skip.
*/
inline void
declare_var_boundary(uint n)
{
m_pboundary= n;
}
//
// Labels
//
......@@ -282,6 +292,13 @@ class sp_pcontext : public Sql_alloc
uint m_poffset; // Variable offset for this context
uint m_coffset; // Cursor offset for this context
/*
Boundary for finding variables in this context. This is the number
of variables currently "invisible" to default clauses.
This is normally 0, but will be larger during parsing of
DECLARE ... DEFAULT, to get the scope right for DEFAULT values.
*/
uint m_pboundary;
DYNAMIC_ARRAY m_pvar; // Parameters/variables
DYNAMIC_ARRAY m_cond; // Conditions
......
......@@ -1290,22 +1290,23 @@ bool multi_update::send_data(List<Item> &not_used_values)
int error;
TABLE *tmp_table= tmp_tables[offset];
fill_record(thd, tmp_table->field+1, *values_for_table[offset], 1);
found++;
/* Store pointer to row */
memcpy((char*) tmp_table->field[0]->ptr,
(char*) table->file->ref, table->file->ref_length);
/* Write row, ignoring duplicated updates to a row */
if ((error= tmp_table->file->write_row(tmp_table->record[0])) &&
(error != HA_ERR_FOUND_DUPP_KEY &&
error != HA_ERR_FOUND_DUPP_UNIQUE))
if (error= tmp_table->file->write_row(tmp_table->record[0]))
{
if (create_myisam_from_heap(thd, tmp_table, tmp_table_param + offset,
error, 1))
if (error != HA_ERR_FOUND_DUPP_KEY &&
error != HA_ERR_FOUND_DUPP_UNIQUE &&
create_myisam_from_heap(thd, tmp_table,
tmp_table_param + offset, error, 1))
{
do_update=0;
DBUG_RETURN(1); // Not a table_is_full error
}
}
else
found++;
}
}
DBUG_RETURN(0);
......
......@@ -1592,7 +1592,12 @@ sp_decls:
sp_decl:
DECLARE_SYM sp_decl_idents type
{ Lex->sphead->reset_lex(YYTHD); }
{
LEX *lex= Lex;
lex->sphead->reset_lex(YYTHD);
lex->spcont->declare_var_boundary($2);
}
sp_opt_default
{
LEX *lex= Lex;
......@@ -1623,6 +1628,7 @@ sp_decl:
lex->sphead->add_instr(in);
ctx->set_default(off, it);
}
ctx->declare_var_boundary(0);
lex->sphead->restore_lex(YYTHD);
$$.vars= $2;
$$.conds= $$.hndlrs= $$.curs= 0;
......
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