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

From: InterRob <rob(dot)marjot(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: generic modelling of data models; enforcing constraints dynamically...
Date: 2009-09-24 16:28:28
Message-ID: 671e36b0909240928i20c7c22cm1d050f42d800fe9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Grzegorz Jaśkiewicz 2009-09-24 16:28:49 Re: Exception 0xC0000005
Previous Message mmoncure 2009-09-24 16:28:16 Re: Exception 0xC0000005