Foreign key parsing and inherited classes

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

Foreign key parsing and inherited classes

От:
"Oliver Elphick" <olly@lfix.co.uk>
Дата:
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 nullprimary 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.Elphick@lfix.co.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 



FAQ