fix of selfreference bug

mysql-test/r/subselect.result:
  test of selfreference
mysql-test/t/subselect.test:
  test of selfreference
This commit is contained in:
unknown 2002-11-24 11:18:32 +02:00
parent fc528393d9
commit 4587dddab9
3 changed files with 6 additions and 2 deletions

View file

@ -15,6 +15,8 @@ Reference 'b' not supported (forward reference in item list)
SELECT (SELECT 1),MAX(1) FROM (SELECT 1);
(SELECT 1) MAX(1)
1 1
SELECT (SELECT a) as a;
Reference 'a' not supported (forward reference in item list)
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
create table t1 (a int);
create table t2 (a int, b int);

View file

@ -6,6 +6,8 @@ SELECT (SELECT 1 FROM (SELECT 1) HAVING a=1) as a;
-- error 1245
SELECT (SELECT 1 FROM (SELECT 1) HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) HAVING a=1) as b;
SELECT (SELECT 1),MAX(1) FROM (SELECT 1);
-- error 1245
SELECT (SELECT a) as a;
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
create table t1 (a int);
create table t2 (a int, b int);

View file

@ -403,8 +403,8 @@ public:
:Item_ident(NullS,table_name_par,field_name_par),ref(item) {}
enum Type type() const { return REF_ITEM; }
bool eq(const Item *item, bool binary_cmp) const
{ return (*ref)->eq(item, binary_cmp); }
~Item_ref() { if (ref) delete *ref; }
{ return ref && (*ref)->eq(item, binary_cmp); }
~Item_ref() { if (ref && (*ref) != this) delete *ref; }
double val()
{
double tmp=(*ref)->val_result();