diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2010-03-14 00:11:06 +0300 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2010-03-14 00:11:06 +0300 |
commit | b9ba7c5c3177246d2be16ef6acb118f0f293b38c (patch) | |
tree | 022d7d903e30322a5acae9956a6c8458761815ae /sql/opt_subselect.cc | |
parent | 895f6e9571ba6e813bd9eb6d3c97564d43167ca2 (diff) | |
download | mariadb-git-b9ba7c5c3177246d2be16ef6acb118f0f293b38c.tar.gz |
Apply fix by oystein.grovlen@sun.com 2010-03-12:
Bug#48213 Materialized subselect crashes if using GEOMETRY type
The problem occurred because during semi-join a materialized table
was created which contained a GEOMETRY column, which is a specialized
BLOB column. This caused an segmentation fault because such tables will
have extra columns, and the semi-join code was not prepared for that.
The solution is to disable materialization when Blob/Geometry columns would
need to be materialized. Blob columns cannot be used for index look-up
anyway, so it does not makes sense to use materialization.
This fix implies that it is detected earlier that subquery materialization
can not be used. The result of that is that in->exist optimization may
be performed for such queries. Hence, extended query plans for such
queries had to be updated.
mysql-test/r/subselect_mat.result:
Update extended query plan for subqueries that cannot use materialization
due to Blobs.
mysql-test/r/subselect_sj.result:
Updated result file.
mysql-test/r/subselect_sj_jcl6.result:
Update result file.
mysql-test/t/subselect_sj.test:
Add test case for Bug#48213 that verifies that semi-join works when subquery select list contain Blob columns. Also verify that materialization is not
used.
sql/opt_subselect.cc:
Disable materialization for semi-join/subqueries when the subquery select list
contain Blob columns.
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r-- | sql/opt_subselect.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 37e55aea3bc..0593856bd60 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -322,7 +322,13 @@ bool subquery_types_allow_materialization(Item_in_subselect *in_subs) default: ;/* suitable for materialization */ } + + // Materialization does not work with BLOB columns + if (inner->field_type() == MYSQL_TYPE_BLOB || + inner->field_type() == MYSQL_TYPE_GEOMETRY) + DBUG_RETURN(FALSE); } + in_subs->types_allow_materialization= TRUE; in_subs->sjm_scan_allowed= all_are_fields; DBUG_PRINT("info",("subquery_types_allow_materialization: ok, allowed")); |