Re: My honours project - databases using dynamically attached entity-properties - Mailing list pgsql-hackers

From Richard Huxton
Subject Re: My honours project - databases using dynamically attached entity-properties
Date
Msg-id 45F6B371.7040606@archonet.com
Whole thread Raw
In response to Re: My honours project - databases using dynamically attached entity-properties  (David Fetter <david@fetter.org>)
Responses Re: My honours project - databases using dynamically attached entity-properties  (David Fetter <david@fetter.org>)
List pgsql-hackers
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.

It doesn't remove the need for run-time DDL if you allow users to add 
their own questions. If I add a "National Insurance No." (Social 
security No) then either it's:
1. Plain text, and can take clearly invalid codes
2. A user-space construct with regexp matches etc (basically recreating DDL)
3. DDL.

And as the example says, you need to create the table types in advance. 
If you want to add e.g. "Work History" (employer, from_date, to_date) to 
a questionnaire then you'll need dynamic DDL (of form #2 or #3 above).

--   Richard Huxton  Archonet Ltd


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Bug in UTF8-Validation Code?
Next
From: Mario Weilguni
Date:
Subject: Re: Bug in UTF8-Validation Code?