Re: My honours project - databases using dynamically attached entity-properties

From: Richard Huxton <dev(at)archonet(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Sean Utt <sean(at)strateja(dot)com>, Gregory Stark <stark(at)enterprisedb(dot)com>, Andrew Hammond <andrew(dot)george(dot)hammond(at)gmail(dot)com>, josh(at)agliodbs(dot)com, pgsql-hackers(at)postgresql(dot)org, Edward(dot)Stanley(at)mcs(dot)vuw(dot)ac(dot)nz
Subject: Re: My honours project - databases using dynamically attached entity-properties
Date: 2007-03-13 17:54:34
Message-ID: 45F6E55A.90101@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Fetter wrote:
> On Tue, Mar 13, 2007 at 02:21:37PM +0000, Richard Huxton wrote:
>> David Fetter wrote:
>>> On Tue, Mar 13, 2007 at 09:31:45AM +0000, Richard Huxton wrote:
>>>> * Another good example is the "questionnaire".
>>> With all due respect, this is a solved problem *without EAV or
>>> run-time DDL*. The URL below has one excellent approach to this.
>>>
>>> <http://www.varlena.com/GeneralBits/110.php>
>> Which broadly speaking was the solution I used for my questionnaire,
>> except I had a restricted set of types so basically just coerced
>> them to text and side-stepped the inheritance issue. To the extent
>> that it's dynamic, it's still just EAV though.
>
> That's precisely the difference between the above solution and yours,
> and it's the difference between a good design and one that will come
> up and bit you on the as^Hnkle.

It's still basically EAV (either approach). The key fault with EAV is
that the tables have no semantic meaning - answer_int contains number of
oranges, days since birth and the price of a tube ticket in pennies.
Now, with a questionnaire that might not matter because everything is an
"answer" and you're not necessarily going to do much more than
count/aggregate it.

>> It doesn't remove the need for run-time DDL if you allow users to add
>> their own questions.
>
> Sure it does. When a user, who should be talking with you, wants to
> ask a new kind of question, that's the start of a discussion about
> what new kind(s) of questions would be generally applicable in the
> questionnaire schema. Then, when you come to an agreement, you roll
> it into the new schema, and the whole system gets an improvement.

Fine, but if you're not letting the user extend the system, then it's
not really addressing Edward's original posting, is it? If the user's
talking to me, I might as well just write the DDL myself - it's the talk
that'll take the time, not writing a dozen lines of SQL.

The interesting part of the problem (from a Comp-Sci point of view) is
precisely in automating part of that discussion. It's providing an
abstraction so that you don't end up with a mass of attributes while
still providing freedom to the user.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2007-03-13 18:02:04 Re: Daylight Saving Time question PostgreSQL 8.1.4
Previous Message Zdenek Kotala 2007-03-13 17:49:57 Re: Daylight Saving Time question PostgreSQL 8.1.4