Help for owners
My online booking system books two customers into the same slot
Short answer
Double booking usually happens when two people book the same slot within seconds and the system checks availability before saving instead of enforcing it at the moment of saving. Other causes are an out-of-date external calendar, time zone mistakes and separate calendars per staff member or room. A database rule that refuses overlaps prevents it.
Does this sound like your situation?
- Two customers turned up for the same appointment, table or room.
- The booking calendar shows two entries at the same time for one person.
- It happens in bursts, for example just after a promotion or a reminder email.
- A time that looked free on the website was already taken in my own calendar.
- It only happens for some staff members, rooms or services.
Why does this happen?
The slot is checked, then saved, with a gap in between
Many systems first ask whether a slot is free and then save the booking as a second step. If two customers press the button within the same moment, both checks say free and both bookings are saved. The check on its own cannot stop this; the rule has to be applied by the database at the moment of saving.
The database does not refuse overlapping times
PostgreSQL has a kind of rule, an exclusion constraint, that makes the database reject any two rows whose time ranges overlap for the same resource. Without a rule like that, or with a plain unique rule that does not understand ranges, overlaps are only prevented by application code that can be bypassed or raced.
Confirmed by postgresql.orgTechnical detail: A UNIQUE constraint in PostgreSQL still lets duplicate rows in when a column is NULL
An outside calendar is read late or only partly
If the booking system reads busy times from a connected calendar, it only knows what that calendar returned when it last asked. Google's free and busy query reports busy periods for the calendars you list, up to a fixed number of calendars per request, so a calendar that is missing from the request is treated as empty.
Confirmed by developers.google.com
Time zones and daylight saving shift the slot
A slot saved without a time zone, or saved in the server's zone, can land an hour away from what the customer saw. Two bookings then overlap in one view and look fine in the other.
Several places create bookings
A website form, a phone booking entered by staff, a marketplace listing and an app may all write bookings. If each one keeps its own list of free times, none of them sees the others at once.
What can I do about it today?
- Contact both customers yourselfCall or message the two customers, apologise and offer the next free time to the one who booked second. Do not let the software send an automatic cancellation until you know which booking is right.
- Write down what happenedNote the slot, the two booking times to the second if the system shows them, the staff member or room, and how each customer booked. This is what lets the cause be found.
- Check every place where bookings are createdList the website, the app, phone entries, marketplaces and any connected calendar. Note whether each one is allowed to create bookings.
- Block the busy slots by hand for nowFor the busiest days, mark the popular slots as unavailable in the calendar after a booking, or confirm each booking by hand before you accept the customer.
- Do not delete either booking recordKeep both until the cause is known, so the history of what each customer was told stays intact.
When should I bring someone in?
- It has happened more than once, or only when many people book at the same time.
- Bookings come from several sources: website, app, phone and a marketplace.
- The booking system is custom-built, or its developer is no longer around.
How do I handle it?
- Reproduce the clashI take one real double booking and replay the two requests in order, with their timestamps, to see which check passed for both.
- Put the rule in the databaseA slot is made impossible to save twice for the same person or room, so the second request fails cleanly and the customer is shown the next free time instead.
- Fix time zones and the shape of a slotTimes are stored with their zone and a start and an end, so a longer appointment blocks everything it covers.
- Make outside calendars a check, not the truthA connected calendar is read as an extra source of busy time, and the booking system's own database stays the record that decides.
- Test with simultaneous requestsI send many bookings for one slot at the same time and confirm that exactly one is saved before anything goes live.
The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.
What do owners ask about this?
Can a booking system ever be fully safe from double booking?
Yes, for bookings that go through the system itself, if the database refuses overlapping times. It cannot control a booking that someone writes straight into an outside calendar.
Is this a problem with my plugin or with my hosting?
Usually with how the plugin or code saves bookings, not the hosting. A slow server makes it more likely because the gap between the check and the save grows.
Do I need to rebuild the whole system?
Not normally. Adding a rule in the database and tightening how bookings are saved is often enough, and the first step is reproducing a real clash.
Will the customer be told the slot is gone?
They can be. The second request should fail with a clear message and offer other times, rather than silently saving a clash.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Found a mistake? Tell me.
For your developer: the technical fixes
The second identical row with a NULL is accepted instead of failing with a duplicate key errorA UNIQUE constraint in PostgreSQL still lets duplicate rows in when a column is NULLERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transactionA statement waited for a lock held by another transaction and gave up (error 1205)ERROR: duplicate key value violates unique constraintON CONFLICT still raises a duplicate key error when a table has several unique constraints