Subject Re: [firebird-support] Re: Auto-increment and generators
Author Milan Babuskov
h_urlaf wrote:
> but that would still fail
>
> INSERT INTO TEST (ID) VALUES (2); SET GENERATOR g1 TO 3;
> INSERT INTO TEST (ID) VALUES (1); SET GENERATOR g1 TO 2;
> INSERT INTO TEST (DATA) VALUES (NULL); /* oops */

Yes, you are correct.

> maybe an AFTER INSERT OR UPDATE trigger could set the generator to
> MAX(ID) if new.ID was not NULL?

AFAIK, SET GENERATOR is treated as DDL, so you cannot embed it into SPs
and Triggers. But I may be wrong?

--
Milan Babuskov
http://fbexport.sourceforge.net