Re: Problem with REFERENCES on INHERITS

Поиск
Список
Период
Сортировка
От William Gordon Rutherdale
Тема Re: Problem with REFERENCES on INHERITS
Дата
Msg-id 54CF4786.6000204@utoronto.ca
обсуждение исходный текст
Ответ на Re: Problem with REFERENCES on INHERITS  (David G Johnston <david.g.johnston@gmail.com>)
Ответы Re: Problem with REFERENCES on INHERITS  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On 02/02/15 12:11 AM, David G Johnston wrote:
> William Gordon Rutherdale wrote
>> My problem:  could someone please explain the semantics and why this
>> behaviour makes sense -- or is it a design error or bug?

> I didn't read your post in depth but I suspect you have not read and
> understood the limitations documented in section 5.8.1
>
> http://www.postgresql.org/docs/9.1/interactive/ddl-inherit.html

Okay, thanks.  The caveats section says this:

    A serious limitation of the inheritance feature is that indexes
    (including unique constraints) and foreign key constraints only
    apply to single tables, not to their inheritance children.

It also says that this 'deficiency' may be fixed in some future release.

Well, I guess that covers it.  I still find it curious:  the particular
form in which it manifests itself.  Instead of simply not performing the
reference check, it over-does it on the derived table.

So this statement:

INSERT INTO banana_stash(primate_id, qty) VALUES
    (1, 17);

Resulted in this error:

ERROR:  insert or update on table "banana_stash" violates foreign key
constraint "banana_stash_primate_id_fkey"
DETAIL:  Key (primate_id)=(1) is not present in table "primate".

How am I to interpret this?  A select * from primate shows that a row
with primate.id exists, yet the error message indicates that it doesn't.

-Will



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

Предыдущее
От: Andreas
Дата:
Сообщение: Can I habe multi table indices?
Следующее
От: Tim Clarke
Дата:
Сообщение: Re: How do I bump a row to the front of sort efficiently