Commit bc1775ff authored by unknown's avatar unknown
Browse files

Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0

into igor-inspiron.creware.com:/home/igor/mysql-5.0

parents 8115f6df f36db354
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -1940,3 +1940,17 @@ s1 s2
DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (f1 char) ENGINE = innodb;
INSERT INTO t1 VALUES ('A');
CREATE VIEW  v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES('B');
SELECT * FROM v1;
f1
A
B
SELECT * FROM t1;
f1
A
B
DROP VIEW v1;
DROP TABLE t1;
+15 −0
Original line number Diff line number Diff line
@@ -1778,3 +1778,18 @@ CALL p1();
DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;

#
# Test for bug #11771: wrong query_id in SELECT * FROM <view>
#

CREATE TABLE t1 (f1 char) ENGINE = innodb;
INSERT INTO t1 VALUES ('A');
CREATE VIEW  v1 AS SELECT * FROM t1;

INSERT INTO t1 VALUES('B');
SELECT * FROM v1;
SELECT * FROM t1;

DROP VIEW v1;
DROP TABLE t1;
+8 −0
Original line number Diff line number Diff line
@@ -641,6 +641,7 @@ class Item {
  virtual bool cleanup_processor(byte *arg);
  virtual bool collect_item_field_processor(byte * arg) { return 0; }
  virtual bool change_context_processor(byte *context) { return 0; }
  virtual bool reset_query_id_processor(byte *query_id) { return 0; }

  virtual Item *equal_fields_propagator(byte * arg) { return this; }
  virtual Item *set_no_const_sub(byte *arg) { return this; }
@@ -895,6 +896,13 @@ class Item_field :public Item_ident
  bool is_null() { return field->is_null(); }
  Item *get_tmp_table_item(THD *thd);
  bool collect_item_field_processor(byte * arg);
  bool reset_query_id_processor(byte *arg)
  {
    field->query_id= *((query_id_t *) arg);
    if (result_field)
      result_field->query_id= field->query_id;
    return 0;
  }
  void cleanup();
  Item_equal *find_item_equal(COND_EQUAL *cond_equal);
  Item *equal_fields_propagator(byte *arg);
+6 −0
Original line number Diff line number Diff line
@@ -3495,6 +3495,12 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
          field->query_id=thd->query_id;
          table->used_keys.intersect(field->part_of_key);
        }
        else
        {
          Item *item= ((Field_iterator_view *) iterator)->item();
          item->walk(&Item::reset_query_id_processor,
                     (byte *)(&thd->query_id));
        }
      }
      /*
	All fields are used in case if usual tables (in case of view used