summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorunknown <dlenev@brandersnatch.localdomain>2004-11-22 13:05:10 +0300
committerunknown <dlenev@brandersnatch.localdomain>2004-11-22 13:05:10 +0300
commit4389be7557d4367cbdc9ec64c4ce4494e54e2822 (patch)
tree1468219151ed11a517ea8241f83b9f4b8f952ff2 /sql/set_var.cc
parentfe37a1472c22b0a48244b932664925cad68f3e96 (diff)
downloadmariadb-git-4389be7557d4367cbdc9ec64c4ce4494e54e2822.tar.gz
Fix for bug #6462 "Same request on same data returns different
results." a.k.a. "Proper cleanup of subqueries is missing for SET and DO statements". (Version #2 with after-review fixes). To perform proper cleanup for statements that can contain subqueries but don't have main select we must call free_undelaid_joins(). mysql-test/r/subselect.result: Added test for bug #6462 "Same request on same data returns different results." a.k.a. "Proper cleanup of subqueries is missing for SET and DO statements". mysql-test/t/subselect.test: Added test for bug #6462 "Same request on same data returns different results." a.k.a. "Proper cleanup of subqueries is missing for SET and DO statements". sql/set_var.cc: Added missing cleanup of joins used in subqueries to SET statement. sql/sql_do.cc: Added missing cleanup of joins used in subqueries to DO statement.
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index a97506ad07c..bc0f2c2a02c 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -2703,13 +2703,18 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list)
while ((var=it++))
{
if ((error=var->check(thd)))
- DBUG_RETURN(error);
+ goto err;
}
- if (thd->net.report_error)
- DBUG_RETURN(1);
- it.rewind();
- while ((var=it++))
- error|= var->update(thd); // Returns 0, -1 or 1
+ if (!thd->net.report_error)
+ {
+ it.rewind();
+ while ((var= it++))
+ error|= var->update(thd); // Returns 0, -1 or 1
+ }
+ else
+ error= 1;
+err:
+ free_underlaid_joins(thd, &thd->lex->select_lex);
DBUG_RETURN(error);
}