Re: generic modelling of data models; enforcing constraints dynamically...

Поиск
Список
Период
Сортировка
Искать
От
InterRob
Тема
Re: generic modelling of data models; enforcing constraints dynamically...
Дата
Msg-id
671e36b0909241327h33cbc993n4f63d2087a2f4ddb@mail.gmail.com
Ответ на
Список
Дерево обсуждения
generic modelling of data models; enforcing constraints dynamically... InterRob <rob.marjot@gmail.com>
Re: generic modelling of data models; enforcing constraints dynamically... Sam Mason <sam@samason.me.uk>
Re: generic modelling of data models; enforcing constraints dynamically... David Fetter <david@fetter.org>
Re: generic modelling of data models; enforcing constraints dynamically... InterRob <rob.marjot@gmail.com>
Re: generic modelling of data models; enforcing constraints dynamically... David Fetter <david@fetter.org>
Re: generic modelling of data models; enforcing constraints dynamically... Peter Hunsberger <peter.hunsberger@gmail.com>
Re: generic modelling of data models; enforcing constraints dynamically... InterRob <rob.marjot@gmail.com>
Re: generic modelling of data models; enforcing constraints dynamically... Oleg Bartunov <oleg@sai.msu.su>
Re: generic modelling of data models; enforcing constraints dynamically... InterRob <rob.marjot@gmail.com>
Re: generic modelling of data models; enforcing constraints dynamically... InterRob <rob.marjot@gmail.com>
Re: generic modelling of data models; enforcing constraints dynamically... Oleg Bartunov <oleg@sai.msu.su>
Re: generic modelling of data models; enforcing constraints dynamically... Ben Chobot <bench@silentmedia.com>
Re: generic modelling of data models; enforcing constraints dynamically... Rob Marjot <rob@marjot-multisoft.com>
Re: generic modelling of data models; enforcing constraints dynamically... Sam Mason <sam@samason.me.uk>
Re: generic modelling of data models; enforcing constraints dynamically... InterRob <rob.marjot@gmail.com>
Re: generic modelling of data models; enforcing constraints dynamically... Sam Mason <sam@samason.me.uk>
Re: generic modelling of data models; enforcing constraints dynamically... InterRob <rob.marjot@gmail.com>
Re: generic modelling of data models; enforcing constraints dynamically... Sam Mason <sam@samason.me.uk>
Re: generic modelling of data models; enforcing constraints dynamically... Ron Mayer <rm_pg@cheapcomplexdevices.com>
Re: generic modelling of data models; enforcing constraints dynamically... Sam Mason <sam@samason.me.uk>
Re: generic modelling of data models; enforcing constraints dynamically... Ron Mayer <rm_pg@cheapcomplexdevices.com>
Re: generic modelling of data models; enforcing constraints dynamically... Erik Jones <ejones@engineyard.com>
Re: generic modelling of data models; enforcing constraints dynamically... InterRob <rob.marjot@gmail.com>
Re: generic modelling of data models; enforcing constraints dynamically... Ben Chobot <bench@silentmedia.com>
Re: generic modelling of data models; enforcing constraints dynamically... InterRob <rob.marjot@gmail.com>
Re: generic modelling of data models; enforcing constraints dynamically... Johan Nel <johan.nel@xsinet.co.za>
Thank you, Ben. Well, I'm afraid you got the basic idea... I intend to implement a hybrid between a fixed schema and an Entity-Attribute-Value scheme. The schema will be able to cover 90% of the data needs; in other cases (specific projects) additional fields (and/or tables/relations) will be needed; including their constraints...

I'm experienting now with some smart thought that just came up: passing a set of key/value pairs to function that will test the new row; on insert / update the following could then be checked (as part of a RULE-set):

SELECT doesComply('relationname', keyValues.*) FROM (VALUES('col1', CAST(col1 AS TEXT)), VALUES('col2', CAST(col2 AS TEXT))) AS keyValues(the_key, the_value);

The function "doesComply()" will then process the CONSTRAINTS table and raise an Error if the new / updated row does not fit...


Any thoughts?


Rob

2009/9/24 Ben Chobot <bench@silentmedia.com>
Rob Marjot wrote:
Thank you, Ben. Well, I'm afraid you got the basic idea... I intend to implement a hybrid between a fixed schema and an Entity-Attribute-Value scheme. The schema will be able to cover 90% of the data needs; in other cases (specific projects) additional fields (and/or tables/relations) will be needed; including their constraints...

If you absolutely must have a dynamic schema like this, and can't have a DBA simply add tables as needed, then I think it would be less work, overall, to create a schema that your application has DDL rights to, and then let it create and modify normal tables with normal constraints there.

There certainly are some cases where an EAV solution is the proper one, and yours may be one of them. But most aren't.


В списке pgsql-general по дате отправления
От: Sam Mason
Дата:
От: InterRob
Дата:
FAQ