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

Re: Error when entering a sales order [SOLVED]



Thanks Jeff,

Armed with a backup of the database, I re-ran transactions_foreign_key_fix.sql. However, I needed to fix the fix first (this might be why I have the problem - I must have missed these errors when I ran it the first time).

In the fix, there are a lot of DDL commands of the form

DROP RULE <name> ON <action> TO <table>;

I'm using PostgreSQL 8.2.6, and it does not like the "<action> TO" bit of the statement. I removed all occurrences of "[insert|update] TO", and re-ran the script. Problem solved.

Richard



Quoting Jeff Kowalczyk <..hidden..>:

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


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Ledger-smb-users mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-users

!DSPAM:3,4878e82d183171769015505!