New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define sequence name for "Identity Column Type" [CORE4191] #4517
Comments
Commented by: @mrotteveel I am not entirely sure what you are asking for, or what problem you want to solve. With regard to IB Expert, I'd think they will add support for the new identity type, negating the problem you identify. If you have special needs for the way primary key values are generated, then you shouldn't - IMHO - use identity, but have a custom trigger that makes your rules explicit (and guards them). |
Commented by: Yakushev.Y (yyy) This is not about IBEXPERT. I'm talking about something like this: create table objects ( |
Commented by: @aafemt For changing of column's properties there is ALTER TABLE query. No need to manage undercover objects separately. |
Modified by: @asfernandesassignee: Adriano dos Santos Fernandes [ asfernandes ] |
Commented by: @asfernandes Rejected in favor of CORE4206. |
Modified by: @asfernandes |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Yakushev.Y (yyy)
Is replaced by CORE4206
Identity Column Type is a good feature.
create table objects (
id integer generated by default as identity primary key,
name varchar(15)
);
insert into objects (name) values ('Table');
insert into objects (name) values ('Book');
insert into objects (id, name) values (10, 'Computer');
select * from objects;
ID NAME
============ ===============
1 Table
2 Book
10 Computer
- 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
as
begin
if (http://new.id is null) then
http://new.id = gen_id(gen_objects_id,1);
end
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.
The text was updated successfully, but these errors were encountered: