dbTalk Databases Forums  

Re: foreign key constraint versus referential integrity constraint

comp.databases.theory comp.databases.theory


Discuss Re: foreign key constraint versus referential integrity constraint in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #61  
Old   
David BL
 
Posts: n/a

Default Re: foreign key constraint versus referential integrity constraint - 10-28-2009 , 12:01 AM






On Oct 28, 1:41 am, Bob Badour <bbad... (AT) pei (DOT) sympatico.ca> wrote:
Quote:
Marshall wrote:

Consider relations A and B each with a single, common attribute.
Natural join and inner union will behave much like intersection
and union in this case. If the result type of the join isn't an
intersection type, then we lose the property:

A = A join (A union B)

because the type of the attribute of the expression is different
than the type of the attribute of A.

I don't see that you do. The type will be the MST of the resulting join.
Because you will join A with a supertype of A, the MST will be the same
as the type of A. This is different from the case joining an integer
with a string because the MST is the universal supertype.
I agree with Bob, although use of the definite article in "the type"
is potentially confusing because a value may have many types (only one
of which is the MST).

Properties like

A = A join (A union B)

are true because it concerns equality of values on the two sides of
the equation, and has nothing to do with static type analysis. It is
similar to how D&D talk about an ellipse variable that inadvertently
holds a circle value when the width and height happen to be equal.
Obviously for every A and B, the MST of

A join (A union B)

will match the MST of A.

Quote:
More generally, the values in the result of a join are the
intersection
of the values in the operands; why wouldn't the result type be the
intersection type?

I am not sure what you mean by the intersection type.
I cannot see any reason not to allow the type system to form a
lattice, i.e. for any two given types there is a well defined "union
type" and "intersection type".

Static type analysis of an expression containing a natural join could
assume that its static type is either the intersection type or the
union type of the static types of the operands. I would suggest the
former is more useful than the latter because statically typed
languages make upcasts implicit and downcasts explicit - so a more
specialised static type is favourable.

Of course at "run time" a particular join result (i.e. value) may have
a dynamic type (i.e. its MST) that is more specific than its static
type.

Reply With Quote
  #62  
Old   
Marshall
 
Posts: n/a

Default Re: foreign key constraint versus referential integrity constraint - 10-28-2009 , 08:26 AM






On Oct 27, 9:33*am, paul c <toledobythe... (AT) oohay (DOT) ac> wrote:
Quote:
Marshall wrote:

...

Consider relations A and B each with a single, common attribute.
Natural join and inner union will behave much like intersection
and union in this case. If the result type of the join isn't an
intersection type, then we lose the property:

* * A = A join (A union B)

because the type of the attribute of the expression is different
than the type of the attribute of A.
...

Marshall, I probably am diverging from your purpose but let me ask if
that property is important because without it you don't have a
relational lattice or is it important because without it some practical
use is lost?
Heh. I think that's a fair question.

I think absorption, (the above property) is in fact something
with practical use, to the optimizer anyway. But I guess
my point is more general, which is to say that the behavior
of the type system ought to match the behavior of the
runtime system. If join puts attribute values together with
AND, then the type system should put type values together
with AND.


Marshall

Reply With Quote
  #63  
Old   
Marshall
 
Posts: n/a

Default Re: foreign key constraint versus referential integrity constraint - 10-28-2009 , 08:31 AM



On Oct 27, 12:41*pm, TroyK <cs_tr... (AT) juno (DOT) com> wrote:
Quote:
On Oct 27, 11:41*am, Bob Badour <bbad... (AT) pei (DOT) sympatico.ca> wrote:

I didn't skip anything, but I missed Ollie's radio collar, which I took
off him before bathing him. I have to mix up another batch of peroxide
and baking soda just for it. I should have just left it on him.- Hide quoted text -

- Show quoted text -

I mostly lurk, but on the subject of skunks and dogs, I can offer some
meaningful advice (since, like mine, your dogs will undoubtedly play
this game again)

Next time, try Dawn dishwashing liquid.
I don't think he's going to like that advice; Bob has gone on record
repeatedly saying mean things about Dawn.


Marshall

Reply With Quote
  #64  
Old   
Marshall
 
Posts: n/a

Default Re: foreign key constraint versus referential integrity constraint - 10-28-2009 , 08:35 AM



On Oct 27, 9:41*am, Bob Badour <bbad... (AT) pei (DOT) sympatico.ca> wrote:
Quote:
I didn't skip anything, but I missed Ollie's radio collar, which I took
off him before bathing him. I have to mix up another batch of peroxide
and baking soda just for it. I should have just left it on him.
Ack! Out of time for news this morning. Hope to reply later.


Marshall

Reply With Quote
  #65  
Old   
Bob Badour
 
Posts: n/a

Default Re: foreign key constraint versus referential integrity constraint - 10-28-2009 , 08:42 AM



Marshall wrote:

Quote:
On Oct 27, 12:41 pm, TroyK <cs_tr... (AT) juno (DOT) com> wrote:

On Oct 27, 11:41 am, Bob Badour <bbad... (AT) pei (DOT) sympatico.ca> wrote:


I didn't skip anything, but I missed Ollie's radio collar, which I took
off him before bathing him. I have to mix up another batch of peroxide
and baking soda just for it. I should have just left it on him.- Hide quoted text -

- Show quoted text -

I mostly lurk, but on the subject of skunks and dogs, I can offer some
meaningful advice (since, like mine, your dogs will undoubtedly play
this game again)

Next time, try Dawn dishwashing liquid.

I don't think he's going to like that advice; Bob has gone on record
repeatedly saying mean things about Dawn.
I am actually allergic to Dawn. I use Sunlight. I started with Sunlight
to wash out as much of the oil as possible before I used the peroxide
and baking soda.

Reply With Quote
  #66  
Old   
paul c
 
Posts: n/a

Default Re: foreign key constraint versus referential integrity constraint - 10-28-2009 , 01:41 PM



Mr. Scott wrote:
Quote:
"Marshall" <marshall.spight (AT) gmail (DOT) com> wrote in message
news:386975f9-472c-4184-8661-5c3d1e2f7621 (AT) r24g2000prf (DOT) googlegroups.com...
On Oct 24, 10:53 am, Keith H Duggar <dug... (AT) alum (DOT) mit.edu> wrote:
Anyhow, the question here is not one of our imagination but rather
simply this: if it makes sense for the RM to support constraints
on relational /values/ (taken on by variables) why does it not
make sense to support constraints on relational /expressions/?
That is a question of general principle not specific design.
This question, it seems to me, is clear and to the point.
And I would answer it by saying that we shouldn't really
even make the distinction! (At least not formally.)

I think we should make the distinction, and formally.

(p /\ q) -> r is not the same as (p -> r) /\ (q -> r)
but (p \/ q) -> r is the same as (p -> r) \/ (q -> r)

A view consisting of a natural join, for example, represents a set of
conjunctions. Each row of the join represents a conjunction of
propositions, one for each operand. A constraint defined on a join would be
of the form (p /\ q) -> r. That is definitely not the same as constraints
defined on one or more tables, which would take the form (p \/ q) -> r.
...
Forgot to mention that I don't see that a "a constraint defined on a
join" would necessarily be "of the form (p /\ q) -> r". I had thought
that many people think it could be any truth-valued expression such as
"(p /\ q) = r".

This leads me to think that most, if not all, view definitions can be
interpreted as constraints. It is interesting to me to then ask what
makes a view different from a base. Is it enough to say that a view
always has one constraint (of possibly several) that is an equality and
a view may be 'updated' without reference to the view?

A more opaque way but perhaps less useful way of saying this is that a
relation's definition in the first place amounts to nothing more than a
constraint.

Reply With Quote
  #67  
Old   
Cimode
 
Posts: n/a

Default Re: foreign key constraint versus referential integrity constraint - 10-28-2009 , 03:17 PM



Snipped
Quote:
*If I recall it
wasn't until his second paper that he introduced the pair of attribute
and domain name, he was adjusting his theory to meet practice.
Precisely.

As for the headers being less relevant in the context of domain
analysis, I meant that domain analysis clearly focuses on the body of
each un-ary relation being primarily a domain subset (*before*
relation level constraints are applied; I use the term with great
caution !) to be considered an attribute of a specific relation. It
is only once domain requirements are met that the assignment of a
specific header defines the attribute (then the header set defining
the relation).

My observation is that a lot of work has been done into defining
relations in order to algebrically operate them as relations but very
little has been done to use domains to clarify relational algebra.
`
My conclusion is that the relational consensus that constraint
specialization through domain analysis could be in any way orthogonal
to relation structural definitions restricts the possibility of
clarifying further relational model operations and implementations.

But that is only my opinion.

Regards...

Reply With Quote
  #68  
Old   
Tegiri Nenashi
 
Posts: n/a

Default Re: foreign key constraint versus referential integrity constraint - 10-28-2009 , 03:29 PM



On Oct 28, 10:41*am, paul c <toledobythe... (AT) oohay (DOT) ac> wrote:
Quote:
Mr. Scott wrote:
"Marshall" <marshall.spi... (AT) gmail (DOT) com> wrote in message
news:386975f9-472c-4184-8661-5c3d1e2f7621 (AT) r24g2000prf (DOT) googlegroups.com....
On Oct 24, 10:53 am, Keith H Duggar <dug... (AT) alum (DOT) mit.edu> wrote:
Anyhow, the question here is not one of our imagination but rather
simply this: if it makes sense for the RM to support constraints
on relational /values/ (taken on by variables) why does it not
make sense to support constraints on relational /expressions/?
That is a question of general principle not specific design.
This question, it seems to me, is clear and to the point.
And I would answer it by saying that we shouldn't really
even make the distinction! (At least not formally.)

I think we should make the distinction, and formally.

(p /\ q) -> r * is not the same as * (p -> r) /\ (q -> r)
but *(p \/ q) -> r * is the same as * (p -> r) \/ (q -> r)

A view consisting of a natural join, for example, represents a set of
conjunctions. *Each row of the join represents a conjunction of
propositions, one for each operand. *A constraint defined on a join would be
of the form (p /\ q) -> r. *That is definitely not the same as constraints
defined on one or more tables, which would take the form (p \/ q) -> r.
...

Forgot to mention that I don't see that a "a constraint defined on a
join" would necessarily be "of the form (p /\ q) -> r". *I had thought
that many people think it could be any truth-valued expression such as
"(p /\ q) = r".

This leads me to think that most, if not all, view definitions can be
interpreted as constraints. *It is interesting to me to then ask what
makes a view different from a base. *Is it enough to say that a view
always has one constraint (of possibly several) that is an equality and
a view may be 'updated' without reference to the view?

A more opaque way but perhaps less useful way of saying this is that a
relation's definition in the first place amounts to nothing more than a
constraint.
Is view definition a constraint? IMO it's purely terminological
matter. Consider relations x and y defined by some algebraic
identities. Is adding new view z (as a function of x and y) adding a
constraint to the system?

Let's analyze a simpler example. Consider two real values constrained
by the equality:

x + y = 5

Is introducing a new variable z, say

z = x - 2y

a new constraint imposed onto the system? Not really, because,
variable z is redundant and can be eliminated, and it doesn't affect
the formal property of the system of being under constrained.

Reply With Quote
  #69  
Old   
paul c
 
Posts: n/a

Default Re: foreign key constraint versus referential integrity constraint - 10-28-2009 , 03:46 PM



Tegiri Nenashi wrote:
....
Quote:
Is view definition a constraint? IMO it's purely terminological
matter. Consider relations x and y defined by some algebraic
identities. Is adding new view z (as a function of x and y) adding a
constraint to the system?

Let's analyze a simpler example. Consider two real values constrained
by the equality:

x + y = 5

Is introducing a new variable z, say

z = x - 2y

a new constraint imposed onto the system? Not really, because,
variable z is redundant and can be eliminated, and it doesn't affect
the formal property of the system of being under constrained.
That is a form of argument that I've seen quite often regarding various
RM questions, not just this one. I'd have no problem with it were it
not called an "example". Since it is about arithmetic, it's at best a
mere analogy to relations and we need to decide whether the analogy
should apply. To try to answer that I would ask when do we ever record
"extensions" of arithmetic equations? In other words, just because we
have abstract operations for both numbers and relations doesn't mean one
should mimic the other. If that's so, maybe somebody else can put it
better.

Reply With Quote
  #70  
Old   
paul c
 
Posts: n/a

Default Re: foreign key constraint versus referential integrity constraint - 10-28-2009 , 03:54 PM



Tegiri Nenashi wrote:
Quote:
... Is adding new view z (as a function of x and y) adding a
constraint to the system?
...
I would say not exactly. More exactly it is adding another relation and
constraining the resulting system (aka the resulting database). That is
different from merely constraining an existing system/database.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.