Skip to content
Permalink
Browse files
HAWQ-474. Fix coredump in tpcds query.
  • Loading branch information
ztao1987 committed Mar 1, 2016
1 parent cd864be commit a6f3665780a7addf4b13bfd57d6cfde06d671512
Showing 1 changed file with 8 additions and 4 deletions.
@@ -79,22 +79,26 @@ tlist_member(Node *node, List *targetlist)
/*
* tlist_member_with_ressortgroupref
* Compared with tlist_member, there is an additional check on ressortgroupref
* If not found, return the first matched member
*/
TargetEntry *
tlist_member_with_ressortgroupref(Node *node, List *targetlist, int ressortgroupref) {
ListCell *temp;
TargetEntry *retentry = NULL;

foreach(temp, targetlist)
{
TargetEntry *tlentry = (TargetEntry *) lfirst(temp);

Assert(IsA(tlentry, TargetEntry));

if (equal(node, tlentry->expr) && (ressortgroupref == 0 ||
ressortgroupref == tlentry->ressortgroupref) )
return tlentry;
if (equal(node, tlentry->expr)) {
if (!retentry) retentry = tlentry;
if (ressortgroupref == 0 || ressortgroupref == tlentry->ressortgroupref)
return tlentry;
}
}
return NULL;
return retentry;
}

/*

0 comments on commit a6f3665

Please sign in to comment.