Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into rurik.mysql.com:/home/igor/mysql-5.1 include/mysql.h: Auto merged mysql-test/lib/mtr_timer.pl: Auto merged scripts/make_binary_distribution.sh: Auto merged sql-common/client.c: Auto merged sql/ha_innodb.cc: Auto merged storage/ndb/src/kernel/blocks/backup/Backup.cpp: Auto merged storage/ndb/src/ndbapi/NdbTransaction.cpp: Auto merged
This commit is contained in:
commit
73970addd8
@ -2553,3 +2553,12 @@ a b
|
|||||||
3 3
|
3 3
|
||||||
drop view v2, v1;
|
drop view v2, v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
INSERT INTO t1 VALUES (1), (2);
|
||||||
|
CREATE VIEW v1 AS SELECT SQRT(a) my_sqrt FROM t1;
|
||||||
|
SELECT my_sqrt FROM v1 ORDER BY my_sqrt;
|
||||||
|
my_sqrt
|
||||||
|
1
|
||||||
|
1.4142135623731
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -2404,3 +2404,17 @@ update v2 set b=3 where a=2;
|
|||||||
select * from v2;
|
select * from v2;
|
||||||
drop view v2, v1;
|
drop view v2, v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #18386: select from view over a table with ORDER BY view_col clause
|
||||||
|
# given view_col is not an image of any column from the base table
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
INSERT INTO t1 VALUES (1), (2);
|
||||||
|
|
||||||
|
CREATE VIEW v1 AS SELECT SQRT(a) my_sqrt FROM t1;
|
||||||
|
|
||||||
|
SELECT my_sqrt FROM v1 ORDER BY my_sqrt;
|
||||||
|
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
11
sql/item.cc
11
sql/item.cc
@ -5114,11 +5114,8 @@ bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference)
|
|||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
A view column reference is considered equal to another column
|
A view column reference is considered equal to another column
|
||||||
reference if the second one is a view column and if both column
|
reference if the second one is a view column and if both column
|
||||||
references point to the same field. For views 'same field' means
|
references resolve to the same item. It is assumed that both
|
||||||
the same Item_field object in the view translation table, where
|
items are of the same type.
|
||||||
the view translation table contains all result columns of the
|
|
||||||
view. This definition ensures that view columns are resolved
|
|
||||||
in the same manner as table columns.
|
|
||||||
|
|
||||||
RETURN
|
RETURN
|
||||||
TRUE Referenced item is equal to given item
|
TRUE Referenced item is equal to given item
|
||||||
@ -5134,8 +5131,8 @@ bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const
|
|||||||
if (item_ref->ref_type() == VIEW_REF)
|
if (item_ref->ref_type() == VIEW_REF)
|
||||||
{
|
{
|
||||||
Item *item_ref_ref= *(item_ref->ref);
|
Item *item_ref_ref= *(item_ref->ref);
|
||||||
DBUG_ASSERT((*ref)->real_item()->type() == FIELD_ITEM &&
|
DBUG_ASSERT((*ref)->real_item()->type() ==
|
||||||
(item_ref_ref->real_item()->type() == FIELD_ITEM));
|
item_ref_ref->real_item()->type());
|
||||||
return ((*ref)->real_item() == item_ref_ref->real_item());
|
return ((*ref)->real_item() == item_ref_ref->real_item());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user