On 04/10/2012, at 8:25 AM, Chuck Hill wrote:
I would NOT be in favour using the PK as in invoice number. That IS offensive! :-P
Heh. I guess it depends on your requirements for an invoice number.
I just object to the use of the PK for a piece of data that has meaning to the user. Sooner or later they want to edit it or control it. "I want them to start with 2013 next year"
Yeah, OK. I'll be able to maintain control of the system I'm working on here, and the answer to that would be "No." But point taken.
So, what's your beef with sparse sequences for invoice numbers (some local tax/legal issue?), and just out of interest, how would you solve the problem then?
I have run into that requirement before. IIRC from someone who was used to a paper system were every invoice was kept, voided or not.
Fair enough—we're talking about different requirements. What I need here is just an immutable, system-generated serial number. In any case, I ended up using ERXSequence.NativeDatabaseSequence on top of a PostgreSQL sequence. So no PKs were harmed. :-)
It is a tricky thing to solve with EOF. An ON INSERT trigger would be one way.
Ah yes, I remember you proposing that in a past thread on the topic.