AW: AW: PLEASE help with foreign key and inheritance pr oble m

Поиск
Список
Период
Сортировка
От Zeugswetter Andreas SB
Тема AW: AW: PLEASE help with foreign key and inheritance pr oble m
Дата
Msg-id 11C1E6749A55D411A9670001FA68796336817C@sdexcsrv1.f000.d0188.sd.spardat.at
обсуждение исходный текст
Список pgsql-hackers
>>
>>     create unique index child_id_index on child (id);

>Thanks a lot. You saved my day :-)))

Always feels good to be able to help :-)

> > > CREATE TABLE will create implicit trigger(s) for FOREIGN 
> KEY check(s)
> > > ERROR:  UNIQUE constraint matching given keys for referenced
> > > table "child"
> > > not found
> >
> > Then the above works.
> > Actually the error message sounds sufficiently clear to me, no?
> 
> I retrospect, yes. Still, I think inheritance could/should do that for me 
> automatically. Is there a good reason why it doesn't ?

None, other that 1. noone implemented it and 2nd there was no generally 
accepted plan on how this should work.

e.g. should the unique index for the serial span the whole hierarchy,
or should a separate index be created for each table ?

As a hint I would keep my fingers off inheritance as it stands now, 
since all it is good for is to save you some typing for the create table
statements. It currently has almost no other functionality except to 
give you the supertable columns for all rows in the hierarchy if you
select * from supertable.

Andreas


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Max Khon
Дата:
Сообщение: left join bug?
Следующее
От: mlw
Дата:
Сообщение: Re: external function proposal for 7.2