Skip to content
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

update or insert with gen_id() with wrong generator value [CORE2041] #2477

Closed
firebird-automations opened this issue Aug 13, 2008 · 8 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Hans Englhauser (englhauser)

Relate to CORE2584
Is related to QA359

I think this runs wrong:

CREATE GENERATOR LOGID;
set generator LOGID to 0;
CREATE TABLE LOGBOOK
( ID integer not null,
TS timestamp,
ENTRY varchar(64),
PRIMARY KEY (ID));

update or insert into logbook (id, ts, entry) values (gen_id(LOGID, 1), 'now','Testing 1');
update or insert into logbook (id, ts, entry) values (gen_id(LOGID, 1), 'now','Testing 2');
update or insert into logbook (id, ts, entry) values (gen_id(LOGID, 1), 'now','Testing 3');
update or insert into logbook (id, ts, entry) values (gen_id(LOGID, 1), 'now','Testing 4');
select * from logbook;

/* ID in table LOGBOOK is not incremented by 1, but by 3.
Workaround is possible with stored procedure: */

set term ^ ;
create procedure logrow(txt varchar(64)) as
declare variable lid integer;
begin
lid = gen_id(LOGID, 1);
update or insert into logbook (id, ts, entry)
values (:lid, 'now',:txt);
end^
set term ; ^

execute procedure logrow('Test 1');
execute procedure logrow('Test 2');
execute procedure logrow('Test 3');
execute procedure logrow('Test 4');
select * from logbook;

Commits: 9150e6f 5d4084d

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.5 Beta 1 [ 10251 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Link: This issue relate to CORE2584 [ CORE2584 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA359 [ QA359 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

QA test added.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test => Done successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants