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

Re: Problem With Saving Parts



Hi Rich and Beamends,

I would be hesitant to suggest this path without chatting with Chris T or one of the other developers first.
The code is, I think, correct.
I suspect that there is a problem elsewhere, most likely with the underlying database.

What version are you running, was the DB setup for this version from scratch, or was the DB migrated from an earlier version?
Also do you have any modified code in LSMB?
I guess it would make sense to ask what version of what OS you are running and also what version of postgresql.

These answers may help the experts answer more quickly.

One more question, how many items do you have in inventory?

I have about three thousand items in mine, with no problems and know that there are others with many more.
Until now I have not heard of any reports about this problem.

One thing I have noticed though, if you try and define multiple "Make and Model" entries for a part you will always get errors (I think they are "duplicate key" errors, but it has been a while).
Never had a problem with multiple vendors though.

Regards
David G


Rich Shepard wrote:
On Wed, 9 Dec 2009, beamends wrote:

  
"DBD::Pg::st execute failed: ERROR: duplicate key violates unique
constraint "partsvendor_pkey" at LedgerSMB/IC.pm line 529.

Error!

INSERT INTO partsvendor
(vendor_id, parts_id,
partnumber, lastcost,
leadtime, curr)
VALUES (?, ?, ?, ?, ?, ?)
ERROR: duplicate key violates unique constraint "partsvendor_pkey"
"
    

Richard,

   I'm not a perl coder, nor a LSMB developer, but I've encountered this type
of SQL error in my approximate reasoning models. The problem is the existing
key and the solution is to write the SQL statement as:

   INSERT or REPLACE into ...

   If the primary key does not exist the new row is inserted; else if the primary
key exists, the column attribute values are replaced with those in the
statement.

   An alternative approach to accomplishing the same thing is to first "DELETE
from <tablename> where ..." followed by the INSERT statement.

HTH,

Rich


------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Ledger-smb-users mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-users