From: Date: July 12 2005 2:18pm Subject: bk commit into 5.0 tree (igor:1.1905) BUG#11771 List-Archive: http://lists.mysql.com/internals/26939 X-Bug: 11771 Message-Id: <20050712121823.3445B18B8E8@rurik.mysql.com> Below is the list of changes that have just been committed into a local 5.0 repository of igor. When igor does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.1905 05/07/12 05:18:05 igor@stripped +4 -0 view.result, view.test: Added a test case for bug #11771. item.h: Fixed bug #11771. Added method reset_query_id_processor to be able to adjust query_id for fields generated from * in queries like this: SELECT * FROM ... sql_base.cc: Fixed bug #11771. Adjusted query_id for fields generated from * in queries like this: SELECT * FROM ... mysql-test/r/view.result 1.85 05/07/12 05:02:52 igor@stripped +14 -0 Added a test case for bug #11771. mysql-test/t/view.test 1.80 05/07/12 05:02:21 igor@stripped +15 -0 Added a test case for bug #11771. sql/item.h 1.149 05/07/12 04:59:42 igor@stripped +8 -0 Fixed bug #11771. Added method reset_query_id_processor to be able to adjust query_id for fields generated from * in queries like this: SELECT * FROM ... sql/sql_base.cc 1.265 05/07/12 04:56:44 igor@stripped +6 -0 Fixed bug #11771. Adjusted query_id for fields generated from * in queries like this: SELECT * FROM ... # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: igor # Host: igor-inspiron.creware.com # Root: /home/igor/dev/mysql-5.0-0 --- 1.148/sql/item.h Sun Jul 3 17:50:00 2005 +++ 1.149/sql/item.h Tue Jul 12 04:59:42 2005 @@ -641,6 +641,7 @@ 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 @@ 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); --- 1.264/sql/sql_base.cc Sat Jul 9 10:55:09 2005 +++ 1.265/sql/sql_base.cc Tue Jul 12 04:56:44 2005 @@ -3495,6 +3495,12 @@ 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 --- 1.84/mysql-test/r/view.result Wed Jul 6 08:28:55 2005 +++ 1.85/mysql-test/r/view.result Tue Jul 12 05:02:52 2005 @@ -1940,3 +1940,17 @@ 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; --- 1.79/mysql-test/t/view.test Wed Jul 6 08:28:29 2005 +++ 1.80/mysql-test/t/view.test Tue Jul 12 05:02:21 2005 @@ -1778,3 +1778,18 @@ DROP PROCEDURE p1; DROP VIEW v1; DROP TABLE t1; + +# +# Test for bug #11771: wrong query_id in SELECT * FROM +# + +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;