Re: 9/18 Visual Planner Meeting Wrapup

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: len(at)pdx(dot)edu
Cc: Mark Wong <markwkm(at)gmail(dot)com>, Postgresql PDX_Users <pdxpug(at)postgresql(dot)org>, David Maier <maier(at)cs(dot)pdx(dot)edu>
Subject: Re: 9/18 Visual Planner Meeting Wrapup
Date: 2008-10-22 16:52:55
Message-ID: 1224694375.19961.39.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug

On Tue, 2008-10-21 at 10:07 -0700, Jeff Davis wrote:
> I think the only correct answer to your problem involves functional
> relationships that cannot be (sanely) materialized (as in my example,
> the functional relationship between a specific timestamp and the hour in
> which it occurs). To be useful, the function must not be one-to-one (as
> in my example), otherwise you could just join using the original value.

[ replying to myself ]

On second thought, there's no reason the function must not be
one-to-one, although many practical examples involve functional
relationships that are not one-to-one.

An example that uses a one-to-one function would be something like:
"give me all events that had a lower turnout than the same event at the
same time on the previous day". This is a self-join using date math
(subtracting one day), so there can't possibly be a FK relationship
there.

Also, I am not 100% sure that correct answers need to use a functional
relationship like that, but they are the only examples I can think of.
This is because a functional relationship is basically like a relation,
except that it can't be materialized within reason (e.g. a relation
representing the + operator would be huge).

The inability to materialize the relation means that it can't be stored
in a variable, and therefore there can be no FK or constraint of any
kind (you can only constrain variables, not values).

Regards,
Jeff Davis

In response to

Browse pdxpug by date

  From Date Subject
Next Message Thomas Keller 2008-10-23 18:23:02 sum of array elements
Previous Message Jeff Davis 2008-10-22 16:52:01 Re: 9/18 Visual Planner Meeting Wrapup