Re: Temporal foreign keys

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: Temporal foreign keys
Дата
Msg-id CA+U5nMJG+G0SyoXnF6r1pkPhJGCwMGekFAXXUoAWXfMOasf8cw@mail.gmail.com
обсуждение исходный текст
Ответ на Temporal foreign keys  (Matthias <nitrogenycs@googlemail.com>)
Список pgsql-general
On Fri, Feb 3, 2012 at 6:58 AM, Matthias <nitrogenycs@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

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Query
Следующее
От: dennis jenkins
Дата:
Сообщение: Re: A 154 GB table swelled to 527 GB on the Slony slave. How to compact it?