Overview
After upgrades or migrations (e.g., Docker or Newired version updates), you may encounter the following error when creating a new Journey:
Why This Happens
PostgreSQL uses a sequence to automatically generate unique IDs for primary key columns. In this case, the sequence responsible for generating values for:
has become out of sync.
This means:
The sequence is attempting to reuse an ID that already exists in the table.
PostgreSQL correctly rejects the insert to prevent duplicate primary keys.
No data is corrupted.
This is a standard sequence alignment issue that can occur after:
System upgrades
Database restores
Container recreation
Migrations
The fix simply requires realigning the sequence with the current maximum ID in the table.
Environment
- Deployment: On-prem
- Containerization: Docker
- Database: PostgreSQL 14.x
- Schema:
journeys - Table:
config_property - Sequence:
journeys.seq_config_property
Resolution Steps
Step 1 – Identify the Database Container
Run:
Look for the container named similar to:
Copy the container ID.
Step 2 – Access the Database Container
Enter the container:
Switch to the postgres user:
Start PostgreSQL:
Step 3 – Re-align the Sequence
Execute the following query:
What This Does
Reads the current highest
idvalue injourneys.config_propertyResets the sequence to match that value
Ensures the next generated ID will not reuse an existing one
Step 4 – If the Issue Persists
If the error still occurs, increase the sequence by one:
This ensures the next generated ID is strictly greater than the current maximum.
Step 5 – Exit and Test
Exit PostgreSQL:
Exit the container if needed:
Retry creating a new Journey in Newired.
Important Notes
This procedure does not delete or modify existing records.
It only adjusts PostgreSQL’s internal auto-numbering counter.
As a best practice, take a database backup before making changes in production environments.
Summary
This issue is caused by a PostgreSQL sequence falling out of sync after an upgrade or migration.
Realigning the sequence resolves the duplicate key error and restores normal Journey creation functionality.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article