The confirmation of Sadiq Khan as Mayor of London last month was delayed for several hours by a database application bug.

The announcement of the election's winner was pushed back from May 6 to May 7 as a result of the programming cockup, which was buried in the IntElect systems used to scan and tabulate citizens' votes.

London Assembly members were told at a hearing on Thursday that a "coding issue" forced IntElect staff to manually query the ballot database to produce the final totals in a spreadsheet.

The election saw Khan voted into the Mayor's office over rival Zac Goldsmith. While the results of the election were not disputed, the tabulation was completed much later than expected: the announcement should have been made Friday evening, but it did not take place until early Saturday.

IntElect is a UK-based joint-venture between DRS Data Services and ERS Group. Its gear was used to read in people's paper ballots and produce tallies.

Three sets of ballots had to be processed per voter: two for Assembly elections, and one for the mayoral race. The latter ballot had a first and second preference option.

IntElect CEO Steve Gowers, who was grilled at the Thursday meeting, said the individual votes were fed into a database, and that this raw information was correct. However, the code that queried the database to pull out the totals was not working properly, leading to "small discrepancies" between the number of paper votes and the reported totals.

When IntElect's techies realized the figures weren't adding up, they ditched their script files and prodded the database by hand to extract the totals.

"We took a decision to abandon the root search for the cause [of the problem] because we knew the underlying data was correct and produced clean queries for that data," Gowers told London Assembly members.

"The manual process was more transparent and allowed us to do more checking."

The Assembly launched an investigation shortly after the election results were announced. We're told the discrepancies were spotted around 4:00pm on polling day. (Gowers insisted the system had been tested prior to deployment.) The issue was reported to City Hall an hour later and, by 6:40pm, a programming blunder was fingered.

DRS has yet to respond to a request for comment on the matter.

City Hall is considering asking IntElect to reimburse some or all of the costs of its election services. ®