Issue Details (XML | Word | Printable)

Key: CORE-6376
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Mark Rotteveel
Votes: 0
Watchers: 3
Operations

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

IDENTITY column with explicit START WITH or INCREMENT BY starts with wrong value

Created: 01/Aug/20 03:15 PM   Updated: 06/Aug/20 04:43 AM
Component/s: Engine
Affects Version/s: 4.0 Beta 2
Fix Version/s: 4.0 RC 1

Environment: Firebird-4.0.0.2126-0_x64 on Windows 10
Issue Links:
Relate
 

QA Status: Covered by another test(s)
Test Details: See test for CORE-6084.


 Description  « Hide
When using an identity column with an explicit START WITH clause, it starts with the wrong value:

SQL> create database 'localhost:e:/db/fb4/identity_test.fdb' user sysdba password 'masterkey';
SQL> create table identity_test (id bigint generated always as identity (start with 1 increment by 10));
SQL> insert into identity_test default values;
SQL> select * from identity_test;

                   ID
=====================
                   11

expected result is 1.

SQL> create table identity_test2 (id bigint generated always as identity (start with 1));
SQL> insert into identity_test2 default values;
SQL> select * from identity_test2;

                   ID
=====================
                    2

expected result is 1

This is also the case for only INCREMENT BY:

SQL> create table identity_test3 (id bigint generated always as identity (increment by 10));
SQL> insert into identity_test3 default values;
SQL> select * from identity_test3;

                   ID
=====================
                   10

Expected result is 1

As I also pointed out in CORE-6084, there are additional problems with negative increments: there the first generated value should be 2^63 -1 (for BIGINT), 2^31 -1 (for INTEGER) or 2^15 -1 (for SMALLINT) if the START WITH clause is absent.

This is related to CORE-6084.


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.