Re: Table filter - Mailing list pgsql-general

From Reg Me Please
Subject Re: Table filter
Date
Msg-id 200711211919.46935.regmeplease@gmail.com
Whole thread Raw
In response to Re: Table filter  ("Rodrigo De León" <rdeleonp@gmail.com>)
List pgsql-general
Il Wednesday 21 November 2007 16:41:03 Rodrigo De León ha scritto:
> On Nov 21, 2007 9:21 AM, Reg Me Please <regmeplease@gmail.com> wrote:
> > Hi all.
> >
> > I've the following concept.
>
> <snip>
>
> This smells like EAV.
>
> Please read
>
> http://joecelkothesqlapprentice.blogspot.com/2006/04/using-one-table-vs-man
>y.html
>
> and consider reevaluating the schema according to valid relational
> design (tables, columns, check constraints, etc.).
>
> In any case, good luck.

You are right, Rodrigo.
It smells like EAV because it is.
But I need to take into account the history of changes for evey single
attribute of every single item.

And what's worst (for me), attributes can be changed for both future values
(that is values getting validity in the future) and past ("history gets
fixed"). A variant of the well known time-travel won't apply properly as I can
get single attributes changed.
Getting the proper attribute list for an item at a certain date it's a snap
in EAV, while it's a nightmare in the usual fields-in-a-table approach.

This is why I'm going EAV (+ timestamps and flags of course).

So the table actually is:

create table t_data
( property text,
  item int8,
  prop_value text,
  flag bool,
  valid timestamptz,
  expires timestamptz,
);

And I hope that there's a better advise for such a scenario.

--
Reg me Please
<Non quietis maribus nauta>

pgsql-general by date:

Previous
From: David Fetter
Date:
Subject: Re: loading a funtion script from a file
Next
From: Tom Lane
Date:
Subject: Re: Restart a sequence regularly