Define sequence name for "Identity Column Type"
-----------------------------------------------
Key: CORE-4191
URL: http://tracker.firebirdsql.org/browse/CORE-4191
Project: Firebird Core
Issue Type: New Feature
Components: Engine
Affects Versions: 3.0 Alpha 1
Reporter: Yakushev.Y
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 (new.id is null) then
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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel