Subject | Re: Auto-increment and generators |
---|---|
Author | h_urlaf |
Post date | 2004-02-10T18:03:24Z |
--- In firebird-support@yahoogroups.com, "Martijn Tonies"
<m.tonies@u...> wrote:
long as they're unique, but in some instances we want a specific ID.
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
<m.tonies@u...> wrote:
> The question is: why are you creating your own ID inBecause we have a situation where the IDs can usually be 'random' as
> the first insert. Without it, there is no spoon. Sorry: problem.
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