Re: globals besides relvars?
Date: Tue, 29 Jul 2003 12:08:11 -0400
"Marshall Spight" <mspight_at_dnai.com> wrote in message news:HwlVa.3170$Oz4.376_at_rwcrnsc54... > "Bob Badour" <bbadour_at_golden.net> wrote in messagenews:HvfVa.1373$Wh2.247889046_at_mantis.golden.net...
> > "Marshall Spight" <mspight_at_dnai.com> wrote in message
> > news:S%bVa.149598$wk6.37711_at_rwcrnsc52.ops.asp.att.net...
> > > > IMO A good catalog model would include relvars to holds things like
> > current timestamp
> > > > and current USER.
> > >
> > > Okay, but why do these things have to be relvars? I mean, the current
> > timezone
> > > is not a relation, it's a value from the timezone domain.
> > Nobody said it has to be a relation. It is a value in a relation. All
> > in relations are values from one domain or another.
> The intent of my question was, why do these things have to be *in* relations?
To apply logic directly.
> > > Current user is a
> > > string or a User value or something. It's not a relation. So why must
> > go
> > > into a relation?
> > So that we can directly apply logic for its management.
> > Logic applies to more things than relations. Logic still applies in a > universe where booleans are the only datatype.
It's not a question of whether logic applies, but a question of whether we can apply logic. A relation is a logical predicate and a set of true instances of the predicate. A tuple is a postulate. The relational calculus is predicate calculus. If you want to apply logic, you must start with the elements of logic. Relations are logic. Variables are not necessarily logic. Arrays are not logic.
If you start with relations, you can apply logic directly. If you start with something else, you cannot.
In fact, a database, together with the operators that apply to the propositions in that database, is a logical system . And when I say "logical system" here, I mean a formal system -- like euclidean geometry, for example -- that has axioms ("given truths") and rules of inference by which we can prove theorems ("derived truths") from those axioms. Indeed, it was Ted Codd's very great insight, when he first invented the relational model back in 1969, that a database isn't really just a collection of data (despite the name); rather, it's a collection of facts, or what the logicians call true propositions. Those propositions -- the given ones, which is to say the ones in the "base tables" -- are the axioms of the logical system under discussion. And the inference rules are essentially the rules by which new propositions are derived from the given ones; in other words, they're basically the operators of the relational algebra. Thus, when the DBMS evaluates some relational expression (in particular, when it's responding to some query), it's really deriving new truths from given ones; in effect, it's proving a theorem!
Hugh Darwen defines a database as a set of axioms."The response to a query is a theorem. The process of deriving the theorem from the axioms is a proof. The proof is made by manipulating symbols according to agreed mathematical rules. The proof [that, is the query result!] is as sound and consistent as the rules are."
> > > I'm already aware that Codd so asserted, but I don't
> > > see any good theoretical or even a good design reason for it.
> > You don't see any good theoretical use for requiring a representation
> > whereby one can use logic directly?
> I don't see how logic is the exclusive province of relations.
Relations are logic. By applying relations, you apply logic directly. By applying arrays, you are not applying logic. By applying arbitrary variables, you are not necessarily applying logic.
> > > Worse, if I make a relvar Timezone, I can issue nonsensical updates
> > > to it. What does it mean to insert into Timezone?
> > You presuppose a nonsensical relvar. Why should subsequent nonsense
> > or alarm anyone? It's just a straw man.
> > You misunderstand. We agreed that timezone could be stored (or whatever > word your prefer for describing what happens when data is placed in a > relation; I use "store") into a relvar.
Then you misunderstand the basic point of relvars. If you are incapable of understanding or are unwilling to understand the difference between logic and physics, it is pointless to discuss logical systems with you. You do not understand the requirement for relation variables because you do not understand the difference between logic and physics, and it is as simple as that.
> What do you propose I call this relvar, > that has exactly one row and exactly one attribute, whose value is a timezone?
Again, you presuppose a nonsensical relvar. Why should subsequent nonsense surprise or alarm anyone? It's just a straw man.
> > > Okay, so maybe
> > > you say the fact that I have a no-columns key for the table makes
> > > that insert fail. Or there's some kind of constraint that prevents
> > > a delete from succeeding. But it would be better if the structure
> > > made it the case that these nonsensical updates weren't even
> > > expressible.
> > Don't use a TimeZone relvar--use a sensible relvar instead.
> Such as?
What TimeZone are we talking about?
> > > That's what you get if you make Timezone a global
> > > *non-relation* variable.
> > A global non-relation TimeZone variable is just as nonsensical as the
> > you propose above.
> It is hard to imagine what you mean when you say that a variable containing
> the current value of the timezone is nonsensical.
The current value of what timezone? There are lots of timezones.
> It seems so obvious to
> me what it means that I can't even explain it.
I suggest that if you understood it you would have no difficulty explaining it.
> It is the variable whose value
> is the timezone. What else is there to say?
What timezone? You presuppose a single, unique timezone, and I see nothing that makes a timezone unique for a potentially distributed system.
> I'm pretty sure you know what
> a variable, a value, and a timezone are.
Yes, I do understand all of those. I also understand when a variable is nonsensical.
> > If one allows the global distribution of a database (and
> > I see no reason to prohibit distribution), the database does not have
> > single, distinct time zone.
> > I'm talking about the logic model. This is the timezone for the current > user, not the physical machine(s).
Then the timezone is an attribute of a relation variable describing current users. It is not a singleton at all. Received on Tue Jul 29 2003 - 18:08:11 CEST