From: | "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk> |
---|---|
To: | pgsql-hackers(at)postgreSQL(dot)org, olly(at)linda(dot)lfix(dot)co(dot)uk |
Subject: | Re: [HACKERS] Problem with foreign keys and inheritance |
Date: | 2000-01-16 15:10:34 |
Message-ID: | 200001161510.PAA09186@linda.lfix.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
"Oliver Elphick" wrote:
>[Version: CVS as of yesterday]
>When I create a table that inherits from another table that uses foreign
>keys, I get something like this:
>
> ERROR: cache lookup of attribute 10 in relation 124171 failed
>
>This is happening in get_attribute_name() of backend/utils/adt/ruleutils.c
Here is an SQL script that makes this happen:
========================================================
create database newj with encoding = 'SQL_ASCII';
\connect newj
create table person
(
id char(10) primary key,
name text not null,
address int,
salutation text default 'Dear Sir',
envelope text,
email text,
www text
);
create table individual
(
gender char(1) check (gender = 'M' or gender = 'F'
or gender is null),
born datetime check ((born >= '1 Jan 1880'
and born <= 'today') or born is null),
surname text,
forenames text,
title text,
old_surname text,
mobile text,
ni_no text,
constraint is_named check (not (surname isnull and forenames isnull))
)
inherits (person);
create table organisation
(
contact char(10) references individual (id) match full,
structure char(1) check (structure='L' or structure='C'
or structure='U' or structure='O')
)
inherits (person);
create table customer
(
acs_code char(8),
acs_addr int, class char(1) default '',
type char(2),
area char(2),
country char(2),
vat_class char(1),
vat_number char(12),
discount numeric(6,3) check (discount >= -50.0::numeric(6,3)
and discount <= 50.0)::numeric(6,3),
commission bool default 'f',
status char(1) default '',
deliver_to int,
factor_code text
)
inherits (organisation);
========================================================
Table customer does not get created; instead, I get:
ERROR: cache lookup of attribute 10 in relation <some_oid> failed
--
From | Date | Subject | |
---|---|---|---|
Next Message | Kristofer Munn | 2000-01-16 15:30:27 | Re: [HACKERS] SELECT...FOR UPDATE OF class_name |
Previous Message | Ansley, Michael | 2000-01-16 11:52:37 | RE: [HACKERS] pg_dump not in very good shape |