@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Give ConpherenceThreadQuery a primary table alias

Summary: Fixes T11113. On the 2nd+ page, we could end up with an ambiguous `id` WHERE clause because we don't define a primary table alias on this query. Define one.

Test Plan:
Changed SearchEngine to return pages of size 5, searched for my threads, toggled to second page, no exception.

Used DarkConsole to examine that second-page query, saw that it had `thread.id` explicitly instead of `id` implicitly.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11113

Differential Revision: https://secure.phabricator.com/D16080

+10 -6
+10 -6
src/applications/conpherence/query/ConpherenceThreadQuery.php
··· 100 100 101 101 $data = queryfx_all( 102 102 $conn_r, 103 - 'SELECT conpherence_thread.* FROM %T conpherence_thread %Q %Q %Q %Q %Q', 103 + 'SELECT thread.* FROM %T thread %Q %Q %Q %Q %Q', 104 104 $table->getTableName(), 105 105 $this->buildJoinClause($conn_r), 106 106 $this->buildWhereClause($conn_r), ··· 144 144 145 145 protected function buildGroupClause(AphrontDatabaseConnection $conn_r) { 146 146 if ($this->participantPHIDs !== null || strlen($this->fulltext)) { 147 - return 'GROUP BY conpherence_thread.id'; 147 + return 'GROUP BY thread.id'; 148 148 } else { 149 149 return $this->buildApplicationSearchGroupClause($conn_r); 150 150 } ··· 156 156 if ($this->participantPHIDs !== null) { 157 157 $joins[] = qsprintf( 158 158 $conn_r, 159 - 'JOIN %T p ON p.conpherencePHID = conpherence_thread.phid', 159 + 'JOIN %T p ON p.conpherencePHID = thread.phid', 160 160 id(new ConpherenceParticipant())->getTableName()); 161 161 } 162 162 163 163 if (strlen($this->fulltext)) { 164 164 $joins[] = qsprintf( 165 165 $conn_r, 166 - 'JOIN %T idx ON idx.threadPHID = conpherence_thread.phid', 166 + 'JOIN %T idx ON idx.threadPHID = thread.phid', 167 167 id(new ConpherenceIndex())->getTableName()); 168 168 } 169 169 ··· 179 179 if ($this->ids !== null) { 180 180 $where[] = qsprintf( 181 181 $conn_r, 182 - 'conpherence_thread.id IN (%Ld)', 182 + 'thread.id IN (%Ld)', 183 183 $this->ids); 184 184 } 185 185 186 186 if ($this->phids !== null) { 187 187 $where[] = qsprintf( 188 188 $conn_r, 189 - 'conpherence_thread.phid IN (%Ls)', 189 + 'thread.phid IN (%Ls)', 190 190 $this->phids); 191 191 } 192 192 ··· 436 436 437 437 public function getQueryApplicationClass() { 438 438 return 'PhabricatorConpherenceApplication'; 439 + } 440 + 441 + protected function getPrimaryTableAlias() { 442 + return 'thread'; 439 443 } 440 444 441 445 }