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

Re: Error when entering a sales order



richard wrote:
> DBD::Pg::st execute failed: ERROR: duplicate key violates unique  
> constraint "transactions_pkey"
> Error!
> INSERT INTO oe
> (id, ordnumber, quonumber, transdate, vendor_id,
> customer_id, reqdate, shippingpoint, shipvia,
> notes, intnotes, curr, closed, department_id,
> employee_id, language_code, ponumber, terms,
> quotation)
> VALUES
> (10547, ?, ?, ?, ?,
> ?, ?, ?, ?,
> ?, ?, ?, ?, ?,
> ?, ?, ?, ?, ?)
> ERROR: duplicate key violates unique constraint "transactions_pkey"

On branches/1.2 the transactions table is keeping track of which table a
certain id references.

  id   | table_name 
-------+------------
 10001 | chart
...
 11440 | customer
 10157 | employee
 10585 | oe
...

I believe it is considered legacy. I had this problem in January 2008.

After consultation on #ledgersmb, I deleted all rows from the table, and
did (if memory serves) INSER INTO transactions (a union of all the row ids
of and their tablenames) for the specific areas I was working with:

SELECT DISTINCT table_name
FROM transactions
ORDER BY table_name;

chart
customer
employee
oe
parts
project
vendor

And everything was fine thereafter.

I regret that I don't have the exact INSERT INTO sql handy to quote here
for you, but I just wanted to reply ASAP that this is not a serious
problem. The transactions table is fairly easy to manipulate and/or
rebuild.

Jeff

P.S. There's an off-by-1 issue, but I can't find a bug filed. The plan was
to backport the track_global_sequence from trunk to branches/1.2.

P.P.S See branches/1.2/sql/fixes/transaction*.sql