[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error Posting a transaction



On Wed, Jul 2, 2008 at 2:55 AM, Matthew Kent <..hidden..> wrote:
> Hi all,
> I am having some strange errors in LSMB. Sometimes a transaction might be
> incorrect, so we will edit it and post again. Usually it works, however
> sometimes it fails with the following error and then transaction just
> disappears. I have had a look in the database and the transaction is just
> gone.
> This error came after somehow I had the same invoice in the system twice, on
> different days. I tried to change the date to the correct date, posted and
> got this:
> DBD::Pg::st execute failed: ERROR: duplicate key violates unique constraint
> "transactions_pkey"

This usually happens because the id sequence has become messed up.

The easiest fix (which corrects most of these) is (as run in the db):

SELECT setval('id', (select max(id) from transactions));

Best Wishes,
Chris Travers