Follow-up: Enforce NOT NULL on event_queue.event_id
The event_id column added to event_queue in #1533 is currently nullable to support a staged rollout and backward compatibility during migration. However, PostgreSQL treats NULL values as distinct, which means the unique constraint event_queue_name_event_id on (name, event_id) does not deduplicate rows where event_id is NULL. This weakens the deduplication guarantee that the PR aims to establish.
Action Required
Once the following conditions are met:
- The backfill script (
views/044_event_queue_event_id_backfill.sql) has been applied and all existing rows have a non-null event_id.
- All writer code paths have been updated to populate
event_id with a non-null UUID.
A follow-up migration should be applied:
ALTER TABLE event_queue ALTER COLUMN event_id SET NOT NULL;
This ensures the uniqueness constraint fully enforces deduplication as intended.
References
Follow-up: Enforce NOT NULL on
event_queue.event_idThe
event_idcolumn added toevent_queuein #1533 is currently nullable to support a staged rollout and backward compatibility during migration. However, PostgreSQL treatsNULLvalues as distinct, which means the unique constraintevent_queue_name_event_idon(name, event_id)does not deduplicate rows whereevent_idisNULL. This weakens the deduplication guarantee that the PR aims to establish.Action Required
Once the following conditions are met:
views/044_event_queue_event_id_backfill.sql) has been applied and all existing rows have a non-nullevent_id.event_idwith a non-null UUID.A follow-up migration should be applied:
This ensures the uniqueness constraint fully enforces deduplication as intended.
References