Issue Details (XML | Word | Printable)

Key: CORE-4191
Type: New Feature New Feature
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Yakushev.Y
Votes: 0
Watchers: 1

If you were logged in you would be able to see more operations.
Firebird Core

Define sequence name for "Identity Column Type"

Created: 23/Aug/13 11:26 AM   Updated: 05/Sep/13 08:38 AM
Component/s: Engine
Affects Version/s: 3.0 Alpha 1
Fix Version/s: None

Issue Links:

 Description  « Hide
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;
============ ===============
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.

  if ( is null) then = 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.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Mark Rotteveel added a comment - 24/Aug/13 06:37 AM
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).

Yakushev.Y added a comment - 27/Aug/13 04:43 PM - edited
This is not about IBEXPERT.

I'm talking about something like this:

create table objects (
id integer generated by OBJECTS_GEN as identity primary key,
name varchar(15)
So :
- no "useless" BI triggers
- information in system tables that ID is generated by OBJECTS_GEN

Dimitry Sibiryakov added a comment - 28/Aug/13 11:18 AM
For changing of column's properties there is ALTER TABLE query. No need to manage undercover objects separately.

Adriano dos Santos Fernandes added a comment - 04/Sep/13 04:00 PM
Rejected in favor of CORE-4206.