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

Re: duplicate key violation on insert to parts



On Thu, Nov 13, 2008 at 1:37 PM, Eamonn Hamilton <..hidden..> wrote:
> Oops, resent from proper address
>
> Hi Guys,
>
> I look after a small ( read : one user ) installation of ledgersmb,
> having moved the data from a sql-ledger system which began several years
> ago.
>
>
> The system has now stopped printing invoices, with the following error :
>
> 2008-11-12 23:27:58 GMT ERROR:  duplicate key value violates unique
> constraint "parts_pkey"
> 2008-11-12 23:27:58 GMT STATEMENT:  INSERT INTO parts (partnumber)
> VALUES ('Wed Nov 12 23:27:58 200811896')

thmmm..  I dont think this is due to lack of parts being defined.

Try this:

select max(id) from parts;
select max(id) from ap;
select max(id) from ar;
select max(id) from gl;

After this, we can try to set it to a suitably high value.

>
>
> I'm guessing this has something to do with the fact that the sytem is
> mainly used for printing invoices, without parts being defined - the
> user just types in a descriptiojn of the work carried out and the
> numbers manually - I know, I know, but it's a labour business ;)

This should only happen if parts are actually in the db and an id
number conflicts, so the question is why.

Also the id is a kind of central sequence so it is good to do  some
exploring before setting it.



Best Wishes,
Chris Travers

>
> Any suggestions on how to fix this?
>
> Many thanks in advance,
> Eamonn
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Ledger-smb-users mailing list
> ..hidden..
> https://lists.sourceforge.net/lists/listinfo/ledger-smb-users
>