Page 1 of 1

Attribute discriminator

PostPosted: Wed Jun 10, 2015 6:28 am
Hi, I have created Generalization Set for column which I named "tipas" and then I've set attribute discriminators for derived entities.


After transforming my ERD to Oracle SQL attribute discriminators change into check constraints on the tables of derived entities. Though Derived entities do not have "tipas" column. I suppose triggers should handle the checking if subtype is assigned correctly. What I am could be doing wrong? Thanks.

Re: Attribute discriminator

PostPosted: Tue Jun 16, 2015 4:46 am
by TomasJkn
Laba diena, Vytautai :),

This is a semi-bug/semi-missing feature. The check constraints in the generated DDL does not work properly for generalization transformation strategy "Multiple Tables, Decomposed Object". Currently it only works for "Multiple Tables, Copy Down" generalization implementation strategy.

When this strategy is used, all the child tables retain the columns from their parent(s) (i.e. columns are copied down, from parent tables into the child tables) and then check constraints work correctly.

I suppose triggers should handle the checking if subtype is assigned correctly

I am not sure about the need of triggers here. I would guess it would be possible to simply generate a different check constraint body for the generalization handling strategy "Multiple Tables, Decomposed Object".
Something along the lines:
CHECK (EXISTS(SELECT * FROM transporto_priemone, krovininis WHERE AND transporto_priemone.tipas='krovininis')))
instead of the simple current case:

I am not sure if such constraints are allowed in Oracle (if not, something else needs to be invented - maybe triggers, as you've suggested).

I will fill in a bug into our bugtracker and we will try to fix this in the future releases. I am just not sure about it's disposition, it may be requalified by product manager as a feature request instead of a bug.

Tomas Juknevičius