Foreign key parsing and inherited classes - Mailing list pgsql-hackers

From Oliver Elphick
Subject Foreign key parsing and inherited classes
Date
Msg-id 199901242036.UAA22137@linda.lfix.co.uk
Whole thread Raw
List 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
nullprimarykey (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
ID32B8FAA1                ========================================    "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
John3:17 
 




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Q about heap_getattr
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Q about heap_getattr