summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@host.loc>2008-02-29 21:28:55 +0400
committerunknown <gshchepa/uchum@host.loc>2008-02-29 21:28:55 +0400
commitd130b8490180f94181e423ef4af0814c69163cbb (patch)
treec1d7accaf96f7110f1855990dda399ec5220b334
parentc8885dfb7328525d4068d6354931e1f68374c605 (diff)
parentd40ca16156641481abd45f93e31233044f4b9df6 (diff)
downloadmariadb-git-d130b8490180f94181e423ef4af0814c69163cbb.tar.gz
Merge host.loc:/home/uchum/work/PP/5.0-opt-34620
into host.loc:/home/uchum/work/5.0-opt-34763
-rw-r--r--mysql-test/r/row.result9
-rw-r--r--mysql-test/t/row.test13
-rw-r--r--sql/item.h29
3 files changed, 51 insertions, 0 deletions
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result
index 702e66fea62..98c79d4bc00 100644
--- a/mysql-test/r/row.result
+++ b/mysql-test/r/row.result
@@ -434,3 +434,12 @@ SELECT @x;
@x
99
DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,1);
+SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a;
+ROW(a, 1) IN (SELECT SUM(b), 1)
+1
+SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a;
+ROW(a, 1) IN (SELECT SUM(b), 3)
+0
+DROP TABLE t1;
diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test
index 20d044306a6..1601f7afd0e 100644
--- a/mysql-test/t/row.test
+++ b/mysql-test/t/row.test
@@ -224,3 +224,16 @@ SET @x:= (SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7));
SELECT @x;
DROP TABLE t1;
+
+#
+# Bug #34620: item_row.cc:50: Item_row::illegal_method_call(const char*):
+# Assertion `0' failed
+#
+
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,1);
+
+SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a;
+SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a;
+
+DROP TABLE t1;
diff --git a/sql/item.h b/sql/item.h
index f87499f23e3..c8b8e48b0ed 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1990,6 +1990,35 @@ public:
Item_field *filed_for_view_update()
{ return (*ref)->filed_for_view_update(); }
virtual Ref_Type ref_type() { return REF; }
+
+ // Row emulation: forwarding of ROW-related calls to ref
+ uint cols()
+ {
+ return ref && result_type() == ROW_RESULT ? (*ref)->cols() : 1;
+ }
+ Item* element_index(uint i)
+ {
+ return ref && result_type() == ROW_RESULT ? (*ref)->element_index(i) : this;
+ }
+ Item** addr(uint i)
+ {
+ return ref && result_type() == ROW_RESULT ? (*ref)->addr(i) : 0;
+ }
+ bool check_cols(uint c)
+ {
+ return ref && result_type() == ROW_RESULT ? (*ref)->check_cols(c)
+ : Item::check_cols(c);
+ }
+ bool null_inside()
+ {
+ return ref && result_type() == ROW_RESULT ? (*ref)->null_inside() : 0;
+ }
+ void bring_value()
+ {
+ if (ref && result_type() == ROW_RESULT)
+ (*ref)->bring_value();
+ }
+
};