Обсуждение: BUG: RI not enforced on inherited foreign keys (v.7.2.1)

Поиск
Список
Период
Сортировка

BUG: RI not enforced on inherited foreign keys (v.7.2.1)

От
"Ernest E Vogelsinger"
Дата:
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name        : Ernest E Vogelsinger
Your email address    : ernest@vogelsinger.at


System Configuration
---------------------
  Architecture (example: Intel Pentium)      : 2 x Intel Pentium 4

  Operating System (example: Linux 2.0.26 ELF)     : Linux version 2.4.9-34smp
(bhcompile@daffy.perf.redhat.com)
                                                  (gcc version 2.96 20000731
(Red Hat Linux 7.2 2.96-108.1))
                          #1 SMP Sat Jun 1 06:15:25 EDT 2002

  PostgreSQL version (example: PostgreSQL-7.2.1):   PostgreSQL-7.2.1

  Compiler used (example:  gcc 2.95.2)        : RedHat RPM


Please enter a FULL description of your problem:
------------------------------------------------

There is a severe problem with foreign keys that are inherited:
RI is NOT enforced on inherited foreign keys.


Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

create table tb1 (
    id    serial primary key
);

create table tb2 (
    id    serial primary key,
    id_tb1    integer references tb1(id),
    id_tb2    integer references tb2(id)
);

create table tb2a (
    data    varchar
) inherits(tb2);

-- these two return an error (correct)
insert into tb2(id_tb1) values (999);
insert into tb2(id_tb2) values (999);

-- but these two work (WRONG!!)
insert into tb2a(id_tb1) values (999);
insert into tb2a(id_tb2) values (999);


If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

Sorry, no idea :) but it certainly needs to be fixed...

   >O     Ernest E. Vogelsinger
   (\)    ICQ#   13394035
    ^

Re: BUG: RI not enforced on inherited foreign keys (v.7.2.1)

От
Stephan Szabo
Дата:
On Fri, 2 Aug 2002, Ernest E Vogelsinger wrote:

> There is a severe problem with foreign keys that are inherited:
> RI is NOT enforced on inherited foreign keys.

This is a known issue with all of foreign keys, unique constraints,
primary keys and triggers.  All of these apply only to the table they're
defined on and in the case of foreign keys to only the table they mention.