mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
Group query results under the "ANCESTOR" operator unconditionally
Summary: Fixes T12753. See that task for reproduction instructions. We add a `GROUP BY` clause to queries with an "ANCESTOR" edge constraint only if the constaint has more than one PHID, but this is incorrect: the same row can be found twice by an ANCESTOR query if task T is tagged with both "B" and "C", children of "A", and the user queries for "tasks in A". Instead, always add GROUP BY for ANCESTOR queries. Test Plan: - Followed test plan in T12753. - Saw proper paging controls after change. - Saw `GROUP BY` in DarkConsole. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12753 Differential Revision: https://secure.phabricator.com/D18012
This commit is contained in:
parent
88466addee
commit
709c304d76
1 changed files with 6 additions and 1 deletions
|
@ -1811,11 +1811,16 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
||||||
case PhabricatorQueryConstraint::OPERATOR_NOT:
|
case PhabricatorQueryConstraint::OPERATOR_NOT:
|
||||||
case PhabricatorQueryConstraint::OPERATOR_AND:
|
case PhabricatorQueryConstraint::OPERATOR_AND:
|
||||||
case PhabricatorQueryConstraint::OPERATOR_OR:
|
case PhabricatorQueryConstraint::OPERATOR_OR:
|
||||||
case PhabricatorQueryConstraint::OPERATOR_ANCESTOR:
|
|
||||||
if (count($list) > 1) {
|
if (count($list) > 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PhabricatorQueryConstraint::OPERATOR_ANCESTOR:
|
||||||
|
// NOTE: We must always group query results rows when using an
|
||||||
|
// "ANCESTOR" operator because a single task may be related to
|
||||||
|
// two different descendants of a particular ancestor. For
|
||||||
|
// discussion, see T12753.
|
||||||
|
return true;
|
||||||
case PhabricatorQueryConstraint::OPERATOR_NULL:
|
case PhabricatorQueryConstraint::OPERATOR_NULL:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue