Skip to content

Commit

Permalink
[CBRD-24119] server corrupted while executing connect by query (#3199) (
Browse files Browse the repository at this point in the history
  • Loading branch information
beyondykk9 authored Nov 11, 2022
1 parent a085051 commit d256f03
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/query/query_opfunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -7123,8 +7123,6 @@ qdata_evaluate_connect_by_root (THREAD_ENTRY * thread_p, void *xasl_p, regu_vari
}
while (bitval); /* the parent tuple pos is null for the root node */

qfile_close_scan (thread_p, &s_id);

/* here tuple_rec.tpl is the root tuple; get the required column */

for (i = 0, valp = xptr->val_list->valp; valp; i++, valp = valp->next)
Expand All @@ -7139,6 +7137,7 @@ qdata_evaluate_connect_by_root (THREAD_ENTRY * thread_p, void *xasl_p, regu_vari
{
if (qexec_get_tuple_column_value (tuple_rec.tpl, i, result_val_p, regu_p->domain) != NO_ERROR)
{
qfile_close_scan (thread_p, &s_id);
return false;
}
}
Expand All @@ -7149,15 +7148,19 @@ qdata_evaluate_connect_by_root (THREAD_ENTRY * thread_p, void *xasl_p, regu_vari
{
if (pr_clone_value (xasl->instnum_val, result_val_p) != NO_ERROR)
{
qfile_close_scan (thread_p, &s_id);
return false;
}
}
else
{
qfile_close_scan (thread_p, &s_id);
return false;
}
}

qfile_close_scan (thread_p, &s_id);

return true;
}

Expand Down Expand Up @@ -7244,19 +7247,19 @@ qdata_evaluate_qprior (THREAD_ENTRY * thread_p, void *xasl_p, regu_variable_node
tuple_rec.tpl = NULL;
}

qfile_close_scan (thread_p, &s_id);

if (tuple_rec.tpl != NULL)
{
/* fetch val list from the parent tuple */
if (fetch_val_list (thread_p, xptr->proc.connect_by.prior_regu_list_pred, vd, NULL, NULL, tuple_rec.tpl, PEEK) !=
NO_ERROR)
{
qfile_close_scan (thread_p, &s_id);
return false;
}
if (fetch_val_list (thread_p, xptr->proc.connect_by.prior_regu_list_rest, vd, NULL, NULL, tuple_rec.tpl, PEEK) !=
NO_ERROR)
{
qfile_close_scan (thread_p, &s_id);
return false;
}

Expand All @@ -7266,6 +7269,7 @@ qdata_evaluate_qprior (THREAD_ENTRY * thread_p, void *xasl_p, regu_variable_node
/* evaluate the modified regu_p */
if (fetch_copy_dbval (thread_p, regu_p, vd, NULL, NULL, tuple_rec.tpl, result_val_p) != NO_ERROR)
{
qfile_close_scan (thread_p, &s_id);
return false;
}
}
Expand All @@ -7274,6 +7278,8 @@ qdata_evaluate_qprior (THREAD_ENTRY * thread_p, void *xasl_p, regu_variable_node
db_make_null (result_val_p);
}

qfile_close_scan (thread_p, &s_id);

return true;
}

Expand Down

0 comments on commit d256f03

Please sign in to comment.