[freeside-users] New Customer reuses Customer ID, has old Invoice data

John Gorkos jgorkos at wildcatwireless.net
Thu Aug 10 09:36:29 PDT 2006


I can tell you that I have never updated/deleted any record in the DB via 
hand.  Since only one record is borked, can I manually find the highest 
customer record currently assigned, make my new customer record one higher, 
and then run fix-sequences?
What other tables reference cust_main.custnum?  Scanning the schema, 
cust_bill, h_cust_tax_exempt, cust_pay, cust_pay_batch, h_cust_main, 
cust_credit, h_cust_main_invoice, cust_refund, h_cust_bill, cust_tax_exempt, 
h_cust_package, h_cust_credit, h_cust_refund, cust_package, h_cust_pay, 
cust_main_invoice.  All but cust_main  and cust_package seem to be billing or 
invoice related.  If I assign the next sequence number to cust_main, and then 
update cust_package to reflect the new custmain, I should be ok...

When I run fix_sequences, all succeed save for:
DBD::Pg::db do failed: ERROR:  relation "part_pkg_pkgpart_seq" does not exist 
at ./fix-sequences line 59.
ERROR:  relation "part_pkg_pkgpart_seq" does not exist at ./fix-sequences line 
59.

That leads me to believe my database is incomplete in some sense.  More 
disturbing is that I have no sequence assigned for cust_main_custnum when I 
\ds in psql and list all sequences.

Any warnings before I jump for it?

John Gorkos

On Thursday 10 August 2006 11:04, Kristian Hoffmann wrote:
> It sounds like either your installation of postgres doesn't seem to know
> what a primary key is, you don't have cust_main.custnum set as a primary
> key in your database schema (possibly an error while upgrading), or you
> deleted old customers manually doing something like "DELETE FROM cust_main
> WHERE custnum = n".
>
> I'm guessing the last option which, for the record, is a really really bad
> idea.  I can't help much for the customers that are already borked, but
> you can prevent further incursions by running the bin/fix-sequences script
> found in the source distribution.  That will reset all of the postgres
> sequences so that the next primary key assigned for each table will be
> greater then the highest primary key for it's table.
>
> Regards,
>
> Kristian Hoffmann
> Fire2Wire System Administrator
> khoff at fire2wire.com
> ---
>
> On Thu, 10 Aug 2006, John Gorkos wrote:
> > I am using Freeside 1.5.8 under Perl::Mason 1.33, Postgres v 7.4.5,
> > Apache 2.2.2 on Mandriva 10.1, Perl 5.8.8, and DBD::Pg 1.49.  I am using
> > the Apache 2 patches provided on the mailing list.
> >
> > I have just installed my first customer after the upgrade to 1.5.8.  The
> > customer appears to have been assigned a customer number from one of my
> > first customers, 3 years ago.  That customer has since been canceled. 
> > The new customer shows the invoice history of the original customer, as
> > well as a leftover balance (the old customer skipped town with my
> > equipment).
> >
> > How do I recover from this, and ensure that new customers get a unique
> > customer ID?
> >
> > John Gorkos
> > Wildcat Wireless Internet.
> > _______________________________________________
> > freeside-users mailing list
> > freeside-users at sisd.com
> > http://420.am/cgi-bin/mailman/listinfo/freeside-users
>
> _______________________________________________
> freeside-users mailing list
> freeside-users at sisd.com
> http://420.am/cgi-bin/mailman/listinfo/freeside-users


More information about the freeside-users mailing list