Identity Column Type is a good feature.
create table objects (
id integer generated by default as identity primary key,
insert into objects (name) values ('Table');
insert into objects (name) values ('Book');
insert into objects (id, name) values (10, 'Computer');
select * from objects;
- Now you don't have to create a "useless" BI trigger.
But I think that this is only a part of the problem.
I think lost of developers use IBExpert, and they press "AutoInc" for the primary key fields, as the don't want to think about them during inserting.
If you have selected this option, then you can choose :
- existing generator;
- new one and set the value.
Or they do the same in a manual way.
CREATE OR ALTER TRIGGER OBJECTS_BI FOR OBJECTS
ACTIVE BEFORE INSERT POSITION 0
if (new.id is null) then
new.id = gen_id(gen_objects_id,1);
If I want to disable "other" triggers in order to add many "proper records" and generate ID, I always have to remember about the trigger OBJECTS_BI.
In Identity Column Type I can't define a generator (existing or new one).
If I don't have a generator, then I can not manage it.
It is usefull to manage generators.
For example if you have 2 databases and copy records to the "main" database. Databases 1 and 2 are separated from the "main" one with a bad connection.
Then you have rules like:
ID (1-999) - "for developer" as every client has "Table", "Book", "Computer"
ID (1000 - 1999) - for the first database.
ID (2000 - 2999) - for the second one .
If you start a new project and in database 1 there are a lot of userfull objects for the new client (but not the kind evetyone needs, ID 1000 - 1101), which other tables refer to, then you'd like to:
- delete from objects where id > 1101;
- set generator gen_objects_id to 1150.
So while Identity Column Type doesn't have an option to define a generator, "useless" BI triggers will remain.