From: Jason K. <ja...@no...> - 2007-01-01 23:02:58
|
> You have to edit the backup and adjust the tables as per FAQ and add > WITH OIDS before you restore. You also have to add a "SELECT > SETVAL('sequence', sequencenumber);" after the "DROP SEQUENCE" lines > and remove the "DROP SEQUENCE" lines. Thank you Dieter. I did this and it has fixed the problem I had with printing assemblies. I made a new invoice just now, and when I ran a report for outstanding invoices for the client, two invoices were displayed, with the same invoice number, date, total, etc. When I opened one of them, I noticed that an old inventory item and payment were added to the invoice along with what I had entered. When I was editing the backup file, I had no trouble adding WITH OIDS to the correct locations, but when I was replacing the DROP SEQUENCE -- Pg-tables.sqlentries with SELECT SETVAL entries I only had a 'sequencenumber' for SEQUENCE id. The invoiceid and orderitemsid SEQUENCES each did not have one: ***Snip from backup file: ... DROP SEQUENCE id ; DROP SEQUENCE invoiceid ; DROP SEQUENCE orderitemsid ; -- ... ... -- Pg-tables.sql CREATE SEQUENCE id start 10000; SELECT nextval ('id'); CREATE SEQUENCE invoiceid; SELECT nextval ('invoiceid'); CREATE SEQUENCE orderitemsid MAXVALUE 100000 CYCLE; SELECT nextval ('orderitemsid'); ... ***End Snip from backup file. I put the following just after the DROP SEQUENCE entries, then deleted the DROP SEQUENCE entries: SELECT SETVAL('id',10000); SELECT SETVAL('invoiceid'); SELECT SETVAL('orderitemsid'); (So, the SELECT SETVAL entries are still above the '-- Pg-tables.sql' line.) Is the lack of a 'sequencenumber' for the invoiceid and orderitemsid SEQUENCES the cause of this problem? If so, how do I determine what values to put in? Jason Kay. |