Repository navigation
Ensure subquery in findNewIds never returns NULL - #8590
IchbinkeinReh wants to merge 1 commit into
Conversation
08bd4fc to
ed2d0da
Compare
|
Change makes sense yet I'm unsure if it fixes #4479 entirely. To verify all our supported databases understand the query we should add an integration test for |
|
|
||
| $found = $this->mapper->findNewIds($mailbox, [$id + 1]); | ||
|
|
||
| self::assertCount(1, $found); |
There was a problem hiding this comment.
this fails without COALESCE 👍
|
On a second look I'm skeptical about 👀 @kesselb |
| // MIN returns NULL if there are no rows selected, therefore we use COALESCE to ensure 0 is returned in this case | ||
| $subSelect | ||
| ->select($sortOrder === IMailSearch::ORDER_NEWEST_FIRST | ||
| ->select('COALESCE(' . ($sortOrder === IMailSearch::ORDER_NEWEST_FIRST |
There was a problem hiding this comment.
This should be wrapped in createFunction
|
IIRC, it was due to the performance concerns of resyncing all the envelopes.
|
cd0fa24 to
081c181
Compare
MIN/MAX of the known-ids subquery returned NULL when none of the passed ids still existed in the mailbox (e.g. expunged messages), which made every comparison against it false and caused mail to disappear and reappear in a loop. COALESCE to a bound within sent_at's 4-byte INTEGER range so the boundary stops excluding rows in either sort direction, including messages with a spoofed pre-epoch sent_at. Fixes nextcloud#4479 Signed-off-by: Patrick Bender <patrick@bender-it-services.de> Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com> Assisted-by: ClaudeCode:claude-sonnet-5
081c181 to
a1ab7b4
Compare
Fixes #4479