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

Let non-null integer type columns be convertible to IDENTITY [CORE5402] #5675

Open
firebird-automations opened this issue Nov 20, 2016 · 1 comment

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @helebor

Is it a trivial change to enable conversion of an integer type column that is populated from a generator from a trigger to IDENTITY type?
Example
------------
create generator id_gen_idtest;
create table idtest (id integer not null, data varchar(10);
commit;
set term ^;
create trigger get_id_idtest for idtest
active before insert as
begin
if (http://new.id is null) then http://new.id = next value for id_gen;
end ^
set term ;^
commit;
insert into idtest (data) values ('first');
insert into idtest (data) values ('second');
insert into idtest (data) values ('third');
insert into idtest (data) values ('fourth');
commit;

Make this possible without the need to remove dependencies:

alter table idtest
alter column id type integer generated by default as IDENTITY (start with 5);
-- not forgetting to
drop trigger get_id_idtest;
commit;

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

It's not allowed per the standard, so it requires agreement.

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

1 participant