1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Fix an issue where a GROUP BY was missing when a query matched a revision using multiple hashes

Summary:
Ref T13581. If you query for revisions by hash and provide multiple hashes (A, B) which match a single revision (e.g., older and newer diffs for that revision), the query omits a GROUP BY clause but should contain one.

Add a GROUP BY clause in this case.

Test Plan:
With a working copy that has multiple hashes corresponding to a single revision, ran `arc branches` before and after the change. Before, got this error:

```
[2020-09-15 17:02:07] EXCEPTION: (ConduitClientException) ERR-CONDUIT-CORE: Rows passed to "loadAllFromArray(...)" include two or more rows with the same ID ("130"). Rows must have unique IDs. An underlying query may be missing a GROUP BY. at [<arcanist>/src/conduit/ConduitFuture.php:65]
```

After, clean execution.

Maniphest Tasks: T13581

Differential Revision: https://secure.phabricator.com/D21462
This commit is contained in:
epriestley 2020-09-15 17:13:21 -07:00
parent 6f78e2a91c
commit 2a83df5786

View file

@ -778,12 +778,19 @@ final class DifferentialRevisionQuery
*/ */
protected function shouldGroupQueryResultRows() { protected function shouldGroupQueryResultRows() {
$join_triggers = array_merge( if (count($this->pathIDs) > 1) {
$this->pathIDs, return true;
$this->ccs, }
$this->reviewers);
if (count($join_triggers) > 1) { if (count($this->ccs) > 1) {
return true;
}
if (count($this->reviewers) > 1) {
return true;
}
if (count($this->commitHashes) > 1) {
return true; return true;
} }