Foreign key parsing and inherited classes

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: PostgreSQL Hackers <hackers(at)postgreSQL(dot)org>
Subject: Foreign key parsing and inherited classes
Date: 1999-01-24 20:36:31
Message-ID: 199901242036.UAA22137@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have some SQL table-creation scripts that include foreign key clauses,
in the hope that it will be implemented soon. This has shown up what seems
to me to be an inadequacy in the planned linkage between foreign keys and
inheritance.

Consider these tables:

create table invoice
(
invno int primary key,
customer char(10) not null
references customer (id),
date datetime not null
default datetime(now()),
custref text
);

create table export_invoice
(
[various fields appropriate to exporting]
)
inherits (invoice)
;

create table invoice_line
(
invno int not null
references invoice* (invno),
product char(10) not null
references price (product),
qty int not null,
price float not null

primary key (invno, product)
)
;

I want invoice_line to reference either invoice or export_invoice,
because there is no difference in the structure of an invoice line
between the two cases. However the parser does not allow
`references invoice*'.

Since this feature of the parser seems likely to make it impossible
to name an inheritance tree in a foreign key reference when foreign
keys are finally implemented, can I suggest that this be changed now,
please?

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP key from public servers; key ID 32B8FAA1
========================================
"If anyone has material possessions and sees his
brother in need but has no pity on him, how can the
love of God be in him?"
I John 3:17

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-01-24 20:51:34 Re: [HACKERS] Q about heap_getattr
Previous Message Tom Lane 1999-01-24 20:05:05 Re: [HACKERS] Q about heap_getattr