Re: Implicit constraints in a view

From: NENASHI, Tegiri <tnmail42_at_gmail.com>
Date: 9 Nov 2006 06:54:17 -0800
Message-ID: <1163084057.931656.27000_at_f16g2000cwb.googlegroups.com>


Aloha Kakuikanu wrote:
> NENASHI, Tegiri wrote:
> > Aloha Kakuikanu wrote:
> > > Please note, that the actions should be consistent. For example, you
> > > can not do
> > >
> > > insert ('JanHidders', 'RMI') into AllPosters;
> > > insert ('JanHidders', 'IMR') into AllPosters;
> > > commit;
> > >
> > > because no transaction on the base tables could produce such result on
> > > the view.
> >
> > Why not ? What constraint does not permit the insert ? The insertion
> > can be done into the tables directly, no ?
>
> When we define a view, we also define some implicit constraints. Here
> is quite an obvious one:
>
> check type = 'IMR' or type = 'RMI' or type = 'I'

It is your fantasme about the constraint: 'type' is a virtual column that the clever implementation of insert can utilize as the selector but to update the virtual column, it does not have sense. I do not say that in your private modele it is not possible; it is possible but you must fix the rules of the play. One can not say: Oh we have that rule, oh, now we have this rule. One can talk about no matter what your private modele but you have to give the rules for the modele.

 >
> I suggest that you are not allowed to do the following
>
> insert ('SomeGuy', 'NotAValidTyp') into AllPosters;

In the modern SQL modele, one can not insert into the virtual column and it has a sense: it does not exist in the database. It is the same like to insert into a table that does not exist.

>
> exactly because of this constraint. Likewise, in the cited example.
> Which constraint:-?
Received on Thu Nov 09 2006 - 15:54:17 CET

Original text of this message