Again about foreign keys and inheritance
От | Dedov Anton |
---|---|
Тема | Again about foreign keys and inheritance |
Дата | |
Msg-id | 20020129104502.0f2799c6.bada@paragon.krasnoyarsk.su обсуждение исходный текст |
Ответы |
Re: Again about foreign keys and inheritance
|
Список | pgsql-sql |
Hi all. Does the problem of accessing an whole inheritance's tree via foreign key resolved? The problem is: in next example an insert into table roaming will fail. Can I solve it anyway?Without foreign keys on parenttables IMHO inheritance is meaningless... Dedov Anton EXAMPLE: create table devs ( devid int, owner int, devtype varchar, primary key (devid) --,-- foreign key (owner) references ab,-- foreign key (devtype) references devtypes ); create table roaming ( dev int, node int, validto timestamp, primary key (dev, node), foreign key (dev) references devs --,-- foreign key (node) references nodes ); create table devs_pocsag ( capcod int unique not null check (capcod > 0), subcod int not null check (subcod >= 0), speed int not null, freq float4 not null, ptype varchar not null, is_inv boolean default 'f', primary key (devid) --, -- foreign key (speed) references pocsag_speeds, -- foreign key (ptype) references pocsag_ptypes, -- foreign key (freq) references pocsag_freqs ) inherits (devs); --... select * from devs_pocsag;devid | owner | devtype | capcod | subcod | speed | freq | ptype | is_inv -------+--------+---------+--------+--------+-------+-------+------------+-------- 0 | 240008 | POCSAG | 240008 | 0 | 1200 | 159.2 | Millennium | f insert into roaming (dev,node) values (0,95); ERROR: <unnamed> referential integrity violation - key referenced from roaming not found in devs
В списке pgsql-sql по дате отправления: