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

Re: Upgrade duplicate key "transactions_pkey" problem SL 2.6.5 -> Ledgersmb 1.1.12




On 6/17/07, Chris Travers <..hidden..> wrote:
Ok.  Here is the problem and the recommended solution.

...


  My recommended solution is:

BEGIN;
LOCK customer IN EXCLUSIVE MODE;
ALTER TABLE customer ADD COLUMN new_id INT;
UPDATE customer SET new_id = nextval('id');
UPDATE ar SET customer_id = (select new_id FROM customer WHERE
customer.id = customer_id);
UPDATE project SET customer_id = (select new_id FROM customer WHERE
customer.id = customer_id);
UPDATE shipto SET trans_id = (select new_id FROM customer where
customer.id = trans_id);
UPDATE customer SET id = new_id;
ALTER TABLE customer DROP COLUMN new_id;
COMMIT;

Do the same for vendor id, updating the vendor_id field in ap and the
trans_id field in shipto.

Thanks very much for this - it  looks a *lot* better than my attempt would have been.

I have run your solution and have now been able to successfully apply the

   /usr/local/lib/egsql-ledger/sql/Pg-upgrade-2.6.17-2.6.18.sql

script manually. 

Unfortunately, I am now getting

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request

and the error log shows

   Premature end of script headers: login.pl

Given the issues I have had with the upgrade, I'll probably try again, starting from scratch, but just in case there is a quick fix, I'll hold off for a while :-)

Cheers
Rob