# Meldingen worden onjuist aangemaakt voor oude berichten

**URL:** <https://meta.discourse.org/t/notifications-being-incorrectly-created-for-old-posts/174247>\
**Category:** Product Support\
**Created:** [25 december 2020 om 08:27 UTC](https://meta.discourse.org/t/notifications-being-incorrectly-created-for-old-posts/174247 "2020-12-25T08:27:46Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Nacho\_Caballero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nacho_caballero/32/130189_2.png) [@Nacho\_Caballero](https://meta.discourse.org/u/Nacho_Caballero)\
**Post date:** [29 december 2020 om 09:48 UTC](https://meta.discourse.org/t/notifications-being-incorrectly-created-for-old-posts/174247/4 "2020-12-29T09:48:35Z")

</div>

The issue seemed to get solved by itself (luckily) after a few days, but digging deeper helped me realize my initial SQL query was incomplete: the `notifications.post_number` field points to the first unread post in a given topic but every time a new post is created, its `notification.created_at` is updated to the new `posts.created_at`.

That explained some of the time discrepancies I was seeing, but not the uptick that mysteriously appeared and went away.

To fix the query, I’d have to first check `post_timings` to find the latest `topic_id`/`post_number` that the given user had seen, and use its `created_at` instead of the one coming from `notifications`.

---

_[View the full topic](https://meta.discourse.org/t/notifications-being-incorrectly-created-for-old-posts/174247)._
