summaryrefslogtreecommitdiff
path: root/sql/sql_derived.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-06-24 14:38:53 -0700
committerIgor Babaev <igor@askmonty.org>2011-06-24 14:38:53 -0700
commitfb22eb1391957c151e14cb8f269fb8112f5252b1 (patch)
tree4bd74c8422403137955174be0c4c4a3096f7b4e8 /sql/sql_derived.cc
parent7880039fc0a2c406fe924e3dcbc09f0691e49007 (diff)
downloadmariadb-git-fb22eb1391957c151e14cb8f269fb8112f5252b1.tar.gz
Fixed LP bug #798576.
If a view/derived table is non-mergeable then the definition of the tmp table to store the rows for it is created at the prepare stage. In this case if the view definition uses outer joins and a view column belongs to an inner table of one of them then the column should be considered as nullable independently on nullability of the underlying column. If the underlying column happens to be defined as non-nullable then the function create_tmp_field_from_item rather than the function create_tmp_field_from_field should be employed to create the definition of the interesting column in the tmp table.
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r--sql/sql_derived.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 9bfa49c5f2d..fb033fb27f6 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -659,13 +659,18 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
!unit->union_distinct->next_select() (i.e. it is union and last distinct
SELECT is last SELECT of UNION).
*/
+ thd->create_tmp_table_for_derived= TRUE;
if (derived->derived_result->create_result_table(thd, &unit->types, FALSE,
(first_select->options |
thd->options |
TMP_TABLE_ALL_COLUMNS),
derived->alias,
FALSE, FALSE))
+ {
+ thd->create_tmp_table_for_derived= FALSE;
goto exit;
+ }
+ thd->create_tmp_table_for_derived= FALSE;
derived->table= derived->derived_result->table;
if (derived->is_derived() && derived->is_merged_derived())