Commit a1f49284 authored by unknown's avatar unknown
Browse files

Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-4.0

into moonbone.local:/work/7672-bug-4.0-mysql

parents 9595cc33 f3f84ed8
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2431,3 +2431,13 @@ AND FK_firma_id = 2;
COUNT(*)
0
drop table t1;
CREATE TABLE t1 (a INT, b INT);
(SELECT a, b AS c FROM t1) ORDER BY c+1;
a	c
(SELECT a, b AS c FROM t1) ORDER BY b+1;
a	c
SELECT a, b AS c FROM t1 ORDER BY c+1;
a	c
SELECT a, b AS c FROM t1 ORDER BY b+1;
a	c
drop table t1;
+9 −0
Original line number Diff line number Diff line
@@ -1983,3 +1983,12 @@ AND FK_firma_id = 2;

drop table t1;

#
# Bug 7672 Unknown column error in order clause
#
CREATE TABLE t1 (a INT, b INT);
(SELECT a, b AS c FROM t1) ORDER BY c+1;
(SELECT a, b AS c FROM t1) ORDER BY b+1;
SELECT a, b AS c FROM t1 ORDER BY c+1;
SELECT a, b AS c FROM t1 ORDER BY b+1;
drop table t1;
+11 −0
Original line number Diff line number Diff line
@@ -348,7 +348,18 @@ bool Item_field::fix_fields(THD *thd,TABLE_LIST *tables)
  {
    Field *tmp;
    if (!(tmp=find_field_in_tables(thd,this,tables)))
    {
      if (thd->lex.select_lex.is_item_list_lookup)
      {
        Item** res= find_item_in_list(this, thd->lex.select_lex.item_list);
        if (res && *res && (*res)->type() == Item::FIELD_ITEM)
        {
          set_field((*((Item_field**)res))->field);
          return 0;
        }
      }
      return 1;
    }
    set_field(tmp);
  }
  else if (thd && thd->set_query_id && field->query_id != thd->query_id)
+1 −0
Original line number Diff line number Diff line
@@ -154,6 +154,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
  lex->slave_thd_opt=0;
  lex->sql_command=SQLCOM_END;
  bzero((char *)&lex->mi,sizeof(lex->mi));
  lex->select_lex.is_item_list_lookup= 0;
  return lex;
}

+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ typedef struct st_select_lex
		      ignore_index, *ignore_index_ptr;
  List<Item_func_match> ftfunc_list;
  uint in_sum_expr, sort_default;
  bool	create_refs, braces;
  bool	create_refs, braces, is_item_list_lookup;
  st_select_lex *next;
} SELECT_LEX;

Loading