mautrix / whatsapp

A Matrix-WhatsApp puppeting bridge
https://maunium.net/go/mautrix-whatsapp
GNU Affero General Public License v3.0
1.26k stars 172 forks source link

Failing to receive group messages after postgres upgrade (14 to 16) #707

Closed BastianLo closed 2 months ago

BastianLo commented 2 months ago

I have my synapse, matrix-wa and postgres set up in docker. I upgraded postgres from 14 to 16.3 by dumping the data with pg_dump, upgrading the db and re-adding the dumped data. Since this upgrade, I fail to receive group messages. Private messages still work fine.

Once I receive a group message, mautrix-wa prints out the following error: ERR Failed to send WhatsApp message to Matrix error="failed to ensure joined: failed to update state store: pq: there is no unique or exclusion constraint matching the ON CONFLICT specification" action="handle whatsapp event" ...

BastianLo commented 2 months ago

I found the problem. The table "mx_user_profile" was missing a unique constraint ("mx_user_profile_room_user_unique"). This issue was probably caused by the database migration. By creating the constraint, everything is now working fine again.