From: Date: May 17 2005 5:08pm Subject: bk commit into 5.0 tree (serg:1.1840) BUG#9758 List-Archive: http://lists.mysql.com/internals/24979 X-Bug: 9758 Message-Id: <20050517150856.35511.qmail@serg.mysql.com> Below is the list of changes that have just been committed into a local 5.0 repository of serg. When serg does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.1840 05/05/17 17:08:43 serg@stripped +6 -0 sql_yacc.yy: missing semicolon added sql_base.cc: bad merge fixed sp_head.cc, view.test, view.result: Correct restoring view name in SP table locking BUG#9758 configure.in: restore -fno-implicit-templates -fno-exceptions -fno-rtti in configure sql/sql_yacc.yy 1.374 05/05/17 17:05:06 serg@stripped +10 -9 missing semicolon added sql/sql_base.cc 1.243 05/05/17 17:05:06 serg@stripped +1 -1 bad merge fixed sql/sp_head.cc 1.134 05/05/17 17:05:06 serg@stripped +16 -22 Correct restoring view name in SP table locking BUG#9758 mysql-test/t/view.test 1.70 05/05/17 17:05:06 serg@stripped +21 -1 Correct restoring view name in SP table locking BUG#9758 mysql-test/r/view.result 1.81 05/05/17 17:05:06 serg@stripped +14 -0 Correct restoring view name in SP table locking BUG#9758 configure.in 1.312 05/05/17 17:05:06 serg@stripped +8 -0 restore -fno-implicit-templates -fno-exceptions -fno-rtti in configure # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: serg # Host: serg.mylan # Root: /usr/home/serg/Abk/mysql-5.0 --- 1.311/configure.in Mon May 16 11:24:28 2005 +++ 1.312/configure.in Tue May 17 17:05:06 2005 @@ -359,6 +359,14 @@ export CC CXX CFLAGS LD LDFLAGS AR +if test "$GCC" = "yes" +then + # mysqld requires -fno-implicit-templates. + # Disable exceptions as they seams to create problems with gcc and threads. + # mysqld doesn't use run-time-type-checking, so we disable it. + CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti" +fi + # Avoid bug in fcntl on some versions of linux AC_MSG_CHECKING("if we should use 'skip-locking' as default for $target_os") # Any variation of Linux --- 1.242/sql/sql_base.cc Mon May 16 19:21:34 2005 +++ 1.243/sql/sql_base.cc Tue May 17 17:05:06 2005 @@ -3307,7 +3307,7 @@ 0) { my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), name->c_ptr(), - table->real_name); + table->s->table_name); map->set_all(); return 1; } --- 1.373/sql/sql_yacc.yy Mon May 16 14:21:31 2005 +++ 1.374/sql/sql_yacc.yy Tue May 17 17:05:06 2005 @@ -3994,6 +3994,7 @@ YYABORT; } } + ; select_option_list: select_option_list select_option @@ -7454,8 +7455,8 @@ /* If we are in SP we want have own LEX for each assignment. This is mostly because it is hard for several sp_instr_set - and sp_instr_set_trigger instructions share one LEX. - (Well, it is theoretically possible but adds some extra + and sp_instr_set_trigger instructions share one LEX. + (Well, it is theoretically possible but adds some extra overhead on preparation for execution stage and IMO less robust). @@ -7464,7 +7465,7 @@ LEX *lex; Lex->sphead->reset_lex(YYTHD); lex= Lex; - + /* Set new LEX as if we at start of set rule. */ lex->sql_command= SQLCOM_SET_OPTION; mysql_init_select(lex); @@ -7477,11 +7478,11 @@ option_type option_value { LEX *lex= Lex; - + if (lex->sphead) { sp_head *sp= lex->sphead; - + if (!lex->var_list.is_empty()) { /* @@ -7491,19 +7492,19 @@ */ LEX_STRING qbuff; sp_instr_stmt *i; - + if (!(i= new sp_instr_stmt(sp->instructions(), lex->spcont, lex))) YYABORT; - + if (lex->ptr - lex->tok_end > 1) qbuff.length= lex->ptr - sp->m_tmp_query; else qbuff.length= lex->tok_end - sp->m_tmp_query; - + if (!(qbuff.str= alloc_root(YYTHD->mem_root, qbuff.length + 5))) YYABORT; - + strmake(strmake(qbuff.str, "SET ", 4), (char *)sp->m_tmp_query, qbuff.length); qbuff.length+= 4; --- 1.80/mysql-test/r/view.result Fri May 13 12:35:56 2005 +++ 1.81/mysql-test/r/view.result Tue May 17 17:05:06 2005 @@ -1712,3 +1712,17 @@ 2 2 4 4 DROP VIEW v2,v1; +DROP TABLE t1, t2; +create table t1 (a int); +create view v1 as select sum(a) from t1 group by a; +create procedure p1() +begin +select * from v1; +end// +call p1(); +sum(a) +call p1(); +sum(a) +drop procedure p1; +drop view v1; +drop table t1; --- 1.69/mysql-test/t/view.test Fri May 13 12:35:56 2005 +++ 1.70/mysql-test/t/view.test Tue May 17 17:05:06 2005 @@ -1521,8 +1521,10 @@ DROP VIEW v1,v2,v3; DROP TABLE t1,t2; +# # BUG#8490 Select from views containing subqueries causes server to hang # forever. +# create table t1 as select 1 A union select 2 union select 3; create table t2 as select * from t1; create view v1 as select * from t1 where a in (select * from t2); @@ -1537,7 +1539,6 @@ # # Test case for bug #8528: select from view over multi-table view # - CREATE TABLE t1 (a int); CREATE TABLE t2 (b int); INSERT INTO t1 VALUES (1), (2), (3), (4); @@ -1549,3 +1550,22 @@ SELECT * FROM v2; DROP VIEW v2,v1; + +DROP TABLE t1, t2; +# +# Correct restoring view name in SP table locking BUG#9758 +# +create table t1 (a int); +create view v1 as select sum(a) from t1 group by a; +delimiter //; +create procedure p1() +begin +select * from v1; +end// +delimiter ;// +call p1(); +call p1(); +drop procedure p1; +drop view v1; +drop table t1; + --- 1.133/sql/sp_head.cc Mon May 9 01:01:23 2005 +++ 1.134/sql/sp_head.cc Tue May 17 17:05:06 2005 @@ -2090,15 +2090,10 @@ typedef struct st_sp_table { - LEX_STRING qname; - bool temp; - TABLE_LIST *table; - /* - We can't use table->lock_type as lock type for table - in multi-set since it can be changed by statement during - its execution (e.g. as this happens for multi-update). - */ - thr_lock_type lock_type; + LEX_STRING qname; /* Multi-set key: db_name\0table_name\0alias\0 */ + uint db_length, table_name_length; + bool temp; /* true if corresponds to a temporary table */ + thr_lock_type lock_type; /* lock type used for prelocking */ uint lock_count; uint query_lock_count; } SP_TABLE; @@ -2150,15 +2145,15 @@ for (; table ; table= table->next_global) if (!table->derived && !table->schema_table) { - char tname[64+1+64+1+64+1]; // db.table.alias\0 + char tname[(NAME_LEN + 1) * 3]; // db\0table\0alias\0 uint tlen, alen; tlen= table->db_length; memcpy(tname, table->db, tlen); - tname[tlen++]= '.'; + tname[tlen++]= '\0'; memcpy(tname+tlen, table->table_name, table->table_name_length); tlen+= table->table_name_length; - tname[tlen++]= '.'; + tname[tlen++]= '\0'; alen= strlen(table->alias); memcpy(tname+tlen, table->alias, alen); tlen+= alen; @@ -2181,14 +2176,15 @@ if (!(tab= (SP_TABLE *)thd->calloc(sizeof(SP_TABLE)))) return FALSE; tab->qname.length= tlen; - tab->qname.str= (char *)thd->strmake(tname, tab->qname.length); + tab->qname.str= (char*) thd->memdup(tname, tab->qname.length + 1); if (!tab->qname.str) return FALSE; if (lex_for_tmp_check->sql_command == SQLCOM_CREATE_TABLE && lex_for_tmp_check->query_tables == table && lex_for_tmp_check->create_info.options & HA_LEX_CREATE_TMP_TABLE) tab->temp= TRUE; - tab->table= table; + tab->table_name_length= table->table_name_length; + tab->db_length= table->db_length; tab->lock_type= table->lock_type; tab->lock_count= tab->query_lock_count= 1; my_hash_insert(&m_sptabs, (byte *)tab); @@ -2236,13 +2232,11 @@ for (i=0 ; i < m_sptabs.records ; i++) { char *tab_buff; - TABLE_LIST *table, *otable; + TABLE_LIST *table; SP_TABLE *stab= (SP_TABLE *)hash_element(&m_sptabs, i); if (stab->temp) continue; - otable= stab->table; - if (!(tab_buff= (char *)thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST)) * stab->lock_count))) DBUG_RETURN(FALSE); @@ -2257,11 +2251,11 @@ that the PS will be invalidated if the functions is deleted or changed. */ - table->db= otable->db; - table->db_length= otable->db_length; - table->alias= otable->alias; - table->table_name= otable->table_name; - table->table_name_length= otable->table_name_length; + table->db= stab->qname.str; + table->db_length= stab->db_length; + table->table_name= table->db + table->db_length + 1; + table->table_name_length= stab->table_name_length; + table->alias= table->table_name + table->table_name_length + 1; table->lock_type= stab->lock_type; table->cacheable_table= 1; table->prelocking_placeholder= 1;