Re: feature requests (possibly interested in working on this): functional foreign keys

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chris Travers <chris(dot)travers(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: feature requests (possibly interested in working on this): functional foreign keys
Date: 2013-02-07 15:04:20
Message-ID: 11418.1360249460@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Chris Travers <chris(dot)travers(at)gmail(dot)com> writes:
> What would be nice to be able to do is to be able to do something like:
> ALTER TABLE inet_assignment ADD FOREIGN KEY (network(inet_address))
> REFERENCES cidr_block(block_def);

> 2. Are there any other major showstoppers I haven't thought of?

The information_schema can't represent such a thing, and this is
unfixable without breaking the SQL standard. I suppose we could omit
functional FK constraints from the information_schema views, but that's
not terribly palatable.

Have you considered just storing the network(inet_address) value in a
separate column (maintained by a BEFORE INSERT/UPDATE trigger) and then
using a regular FK with that?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ken Benson 2013-02-07 15:24:14 Re: Re: [NOVICE] Problems with ñ and tildes / CSV import problems in PostgreSQL 9.1
Previous Message Jaime Casanova 2013-02-07 15:03:55 Re: [NOVICE] Problems with ñ and tildes / CSV import problems in PostgreSQL 9.1