IDENTITY data type

The IDENTITY data type was introduced in Firebird 3.0.

The IDENTITY data type spawns unique identifiers for the defined column from an internal generator.

The following is an excerpt from the The Firebird 3.0 Release Notes (27 January 2014 - Document v.0300-08 - for Firebird 3.0 Alpha 2):

IDENTITY column type

Adriano dos Santos Fernandes

An identity column is a column associated with an internal sequence generator. Its value is set automatically when the column is omitted in an INSERT statement.

Syntax Patterns

<column definition> ::=
    <name> <type> GENERATED BY DEFAULT AS IDENTITY [ (START WITH <value>) ]<constraints>

When defining a column, the optional START WITH clause allows the generator to be initialised to a value other than zero. See Tracker ticket CORE-4199.

<alter column definition> ::=

   <name> RESTART [ WITH <value> ]

A column definition can be altered to modify the starting value of the generator. RESTART alone resets the generator to zero; the option WITH <value> clauselet allows the restarted generator to start at a value other than zero. See Tracker ticket CORE-4206.

Rules:

Notes:

Example

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

Implementation Details

Two new columns have been inserted in RDB$RELATION_FIELDS to support identity columns: RDB$GENERATOR_NAME and RDB$IDENTITY_TYPE.

Source: The Firebird 3.0 Release Notes by Helen Borrie (Collator/Editor): 27 January 2014 - Document v.0300-08 - for Firebird 3.0 Alpha 2.