generic modelling of data models; enforcing constraints dynamically...
От | InterRob |
---|---|
Тема | generic modelling of data models; enforcing constraints dynamically... |
Дата | |
Msg-id | 671e36b0909240928i20c7c22cm1d050f42d800fe9@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: generic modelling of data models; enforcing constraints
dynamically...
Re: generic modelling of data models; enforcing constraints dynamically... Re: generic modelling of data models; enforcing constraints dynamically... Re: generic modelling of data models; enforcing constraints dynamically... |
Список | pgsql-general |
Dear List,
I am trying to implement the following:
In a database I wish to implement a GENERIC datamodel, thus on a meta-level. All RELATIONS (part of a MODEL) will be a view on some base (being a table) JOINed with (an) extra column(s). Thus, this view consists of a number of FIELDS. I whish to make this view editable (INSERT, UPDATE) using the RULE system. Some constraints will apply; enforcing these is the problem I am trying to solve by modeling these rules with a table "RELATION_CONSTRAINTS" (see below).
Tables:
BASE(col1, col2, col3)
MODELS(name)
RELATIONS(modelname, name)
FIELDS(modelname, relation_name, name, datatype)
RELATION_CONSTRAINTS(modelname, relation_name, constraint_name, constraining_expression)
I was thinking of implementing this using a FUNCTION that takes a polymorphic record parameter (and the relation name); then checking this record against the applicable constraint expression.
This whole idea may sound like a DBMS-in-a-DBMS kind of thing... What I am trying is to write as little as table/view-specific code as would be necessary, while still collecting all base data in one central table...
All suggestions are very much appreciated,
regards,
Rob
В списке pgsql-general по дате отправления: