Subject Re: Auto-increment and generators
Author h_urlaf
--- In firebird-support@yahoogroups.com, "Martijn Tonies"
<m.tonies@u...> wrote:

> The question is: why are you creating your own ID in
> the first insert. Without it, there is no spoon. Sorry: problem.

Because we have a situation where the IDs can usually be 'random' as
long as they're unique, but in some instances we want a specific ID.

> If you want a generator to generate IDs, then do so. Always.

Then what is the point of things like

if (new.ID is null) then new.ID = gen_id(g1, 1);

(which Helen pointed out as being a Good Thing). If what you're saying
is right, I ought to omit the "if (new.ID is null) THEN" part, and add
an update trigger that does
new.ID = old.ID
to make sure people don't update these IDs. Right?

Thanks,
Emiliano