On Fri, Feb 3, 2012 at 6:58 AM, Matthias <nitrogen...@googlemail.com> wrote:

> how can I implement temporal foreign keys with postgresql? Is writing
> triggers the only way to enforce temporal referential integrity
> currently?

I think you need to explain what you want slightly better.

My guess would be you want this

  create table x (d daterange primary key);
  create table y (e date references x (d));

which is a lookup to show that the date is within a valid date range.

But you may also want this...

  create table x (id integer, d daterange, primary key(id, d));
  create table y (id integer, xid integer, e date, foreign key (xid,
e) references x (id, d));

which is to locate the valid row within a temporal lookup table.

Neither is possible, as yet.

Or you might want something entirely different?

-- 
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to