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

Re: Problem With Saving Parts

Just thought of another question.

How many vendors do you have on the system?
Possibly also relevant how many vendors do you have for each part?

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.


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


   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

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



Return on Information:
Google Enterprise Search pays you back
Get the facts.
Ledger-smb-users mailing list