Subject | doing cascade update manually? |
---|---|
Author | David Garamond |
Post date | 2003-12-13T16:46:39Z |
create table t1 (id int not null primary key, i int, unique(i));
create table t2 (id int not null primary key, i int references t1(i));
insert into t1 values (1,1);
insert into t1 values (2,2);
insert into t2 values (1,1);
t2(i) is not declared 'cascade update'. Can I update t1(i) like this
update t1 set i=3 where id=1;
as well as updating t2(i)? In other words, I want to do cascade
manually/case-by-case in this situation (sometimes I want to forbid
changes to a referenced unique column, and sometimes I want to allow
that change and propagating the changes to all referencing columns as well).
--
dave
create table t2 (id int not null primary key, i int references t1(i));
insert into t1 values (1,1);
insert into t1 values (2,2);
insert into t2 values (1,1);
t2(i) is not declared 'cascade update'. Can I update t1(i) like this
update t1 set i=3 where id=1;
as well as updating t2(i)? In other words, I want to do cascade
manually/case-by-case in this situation (sometimes I want to forbid
changes to a referenced unique column, and sometimes I want to allow
that change and propagating the changes to all referencing columns as well).
--
dave