[sr-dev] [kamailio/kamailio] presence module triggering postgres constraint when marking records for deletion (#600)

Emmanuel Schmidbauer notifications at github.com
Thu May 5 20:53:04 CEST 2016


We are using the `presence` module and have noticed many errors in the log as follows:
```WARNING: db_postgres [km_dbase.c:240]: db_postgres_submit_query(): postgres result check failed with code 7 (PGRES_FATAL_ERROR)
WARNING: db_postgres [km_dbase.c:244]: db_postgres_submit_query(): postgres query command failed, connection status 0, error [ERROR:  duplicate key value violates unique constraint "presentity_presentity_idx"#012DETAIL:  Key (username, domain, event, etag)=(user+test2, phonedev.test2.io, dialog, *#-OFFLINE-#*) already exists.#012]```

I looked over the `presentity.c` code and it appears that the module is marking the records for deletion once they expire by setting the `etag` to `*#-OFFLINE-#*`

This is triggering the postgres constraint and throwing the error. I am confused why the module is using the `etag` column to mark for deletion since it is part of a constraint. Why not add a new column such as `delete_record` and set it to true?

If there is no good reason for this, I would like to propose a patch to add said column.
Please let me know if I am misunderstanding anything here, thanks.
Emmanuel

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/600
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20160505/6bdc0548/attachment.html>


More information about the sr-dev mailing list