Re: relation types

From: Paul Vernon <paul.vernon_at_ukk.ibmm.comm>
Date: Fri, 5 Sep 2003 17:53:46 +0100
Message-ID: <bjaf87$110u$1_at_gazette.almaden.ibm.com>


"Bob Badour" <bbadour_at_golden.net> wrote in message news:mD36b.550$NE7.51862636_at_mantis.golden.net... [snip]
> > I guess (one of) my issues is: If relation values have constraints, where
> > it that information held ?
>
> In the literal that describes the value.

Fancy having a go at some syntax? D&D's (and my) syntax for a relation literal looks like

  RELATION {

        TUPLE { P# P#( 'P1' ), PNAME 'Nut' }
  ,     TUPLE { P# P#( 'P2' ), PNAME 'Bolt' }
  }

which specifies and (unnamed) relation value of type

  RELATION { <P#, P#>, <PNAME, STRING> }

and has the meaning (or 'predicate' if you prefer)

    "Part P1 is called Nut"
    "Part P2 is called Bolt"

Lets say {P#} and {PNAME} are declared candidate keys of this relation, what would your relation literal, corresponding type definition and 'predicate' look like?

> > > I
> > > resolve this by noting that these generic operations operate on declared
> > > types rather than most specific types; thus, a constraint declared for a
> > > relation affects the type of the result of an operation.
> >
> > > You resolve this by tossing constraint inference.
> >
> > for values, not variables.
>
> Fair enough, but you suggest we ignore D&D's model for view updatability,
> which makes constraint inference for variables less important.

True(ish).

> > But does it make sense to say the relational operators operate on
> variables and
> > relational expressions as well as values?
>
> Ordinarily, assignments (and assignment shorthands) operate on variables and
> all other operations operate on values. It does not matter to most
> operations whether the value is the current value of some variable or
> derived from some expression or a literal.

OK, I'll accept that most operators ultimately operate on values.

[snip]
> > We can apply them, we just loose constraint inference if we have no value
> > constraints.
>
> We lose all the relational operations if the relational operations are
> defined to infer constraints with a mandatory candidate key constraint.

No. We would just define the key of the result of any relational operation to consist of all the resulting attributes. We loose constraint inference, not the relational operations themselves.

> > [snip]
> > > I agree that it involves the difference between declared type and most
> > > specific type, but I am not certain we should limit declared type to
> > > relvars.
> >
> > I need more thought here. I want to consider what this means to database
> values.
> > Database values do have some place to hold the information about
> constraints - in
> > catalog tuples...
>
> Whether the catalog is an operation on a database variable or a relation
> variable or a relation is someone arbitrary.

The catalog is a value. Specifically a subset of the database value.

I'm thinking that I can rescue constraint inference by seeing it as manipulation of catalog tuples in the database values of database operators.....

Regards
Paul Vernon
Business Intelligence, IBM Global Services Received on Fri Sep 05 2003 - 18:53:46 CEST

Original text of this message