Subject Re: Auto-increment and generators
Author h_urlaf
--- In firebird-support@yahoogroups.com, Phil Shrimpton <phil@s...> wrote:

> > So would I, but here's the situation: we have a 'mailbox ID' that
> > is generally random (doesn't matter, as long as it's unique). Some
> > organizations, however, want to specifically set this ID at some
> > point (to phone numbers, personnel ID, what-have-you), and this
> > change may have to happen on a database that is already deployed.
>
> Repeat after me, Primary Keys should not contain business data....
> Primary Keys should not contain business data....

I don't need to; it already isn't the case. The user has a UserID,
which is his PK. He *also* has a mailbox ID, which is 'bussiness
data'. It must be unique, and since most clients don't care what it is
(do not wish to link it to bussiness data), we would prefer to
auto-generate it, and offer the client an interface to change the
auto-generated mailbox numbers to numbers that are meaningful within
the organization.

> Business data can, and will change, but 'meaningless' values won't.
> If a 'mailbox' record needs to contain a unique 'personnel ID' or
> 'phone number' make it a separate field and slap a unique index on
> it.

That is exactly what I have. We don't know what bussiness data a
customer will choose for the mailbox ID, *if any*. All we know is that
it will be numeric, and unique.

Emiliano