Subject: Re: CAP: Badly formed SQL

From: "John Stracke" <[email-masked]>
Date: Thu, 10 Jan 2002 14:43:23 -0500

>>> C: QUERY:SELECT DTSTART,DTEND,SUMMARY,UID,VALARM.*
>>> C:    FROM VEVENT,VTODO
>>> C:    WHERE VALARM.TRIGGER >= '19990310T080000Z'
>>> C:    AND VALARM.TRIGGER <= '19990310T190000Z'
>>> C:    AND METHOD IS BOOKED

>Having forgotten most of the SQL I knew from my dB days I dont see
>that any joins, etc are really going to happen (or should happen).
>Just because we use SQL-MIN does not mean we are mandating that the
>CS actually use SQL as its engine, right??

No, but we are mandating (I think) that it behave like a SQL engine at the 
CAP layer; and, at that layer, the query is asking for a join ("FROM 
VEVENT,VTODO").

>So, for the cited example query why wouldnt the CS just return all the 
data that match the parameters.

Because it wasn't asked for all of them.  It was asked for just the 
parameters (columns) "DTSTART, DTEND, SUMMARY, UID, VALARM.*".

Whether or not this means doing a join (the Cartesian product of the two 
tables) behind the scenes is irrelevant; it's only required that the CS 
return results as if it had done a join.  There's nothing surprising here; 
that's how normal SQL databases behave.  If you ask your database to do a 
join on two million-row tables, it doesn't first construct a trillion-row 
table and then select from it; it just pretends.

/=================================================================\
|John Stracke                   |Principal Engineer               |
[email-masked]  |Incentive Systems, Inc.          |
|http://www.incentivesystems.com|My opinions are my own.          |
|=================================================================|
|If jumping off a bridge was "the industry standard", would you do|
|it?                                                              |
\=================================================================/

---

From: "Shannon J. Clark" <[email-masked]>
Date: Thu, 10 Jan 2002 14:02:48 -0600

John - just to add a note of levity...

Your write: "If you ask your database to do a
join on two million-row tables, it doesn't first construct a trillion-row
table and then select from it; it just pretends"

well - if you ask it correctly... it most SQL books they cite poorly
constructed queries that do result in massive results tables as an easy
mistake to make...

On a more serious note, this raises the point that our syntax should be
standard and clear to avoid easy mistakes on the part of either developers
of CS (or CUA) as well as on the part of users.

I strongly suspect that under most cases users will NOT be handwriting
VQUERY's rather, a VQUERY will be created for the user on the user's behalf
by the CUA software.

Shannon

-----Original Message-----
From: [email-masked]
[mailto:[email-masked]]On Behalf Of John Stracke
Sent: Thursday, January 10, 2002 1:43 PM
To: [email-masked]
Subject: Re: CAP: Badly formed SQL

---

From: Doug Royer <[email-masked]>
Date: Thu, 10 Jan 2002 16:29:31 -0700

"Shannon J. Clark" wrote:

> ...On a more serious note, this raises the point that our syntax
> should be standard and clear to avoid easy mistakes on the part
> of either developers of CS (or CUA) as well as on the part of
> users.
>
> I strongly suspect that under most cases users will NOT be
> handwriting VQUERY's rather, a VQUERY will be created for the
> user on the user's behalf by the CUA software.

Yes!

And as SQL-MIN was designed to provide the MINIMUM requirements
for a CAP server, perhaps we should instead specify that
SQL-MIN is exact set of named SQL queries (perhaps pre-named)? 
I would tend to say no, but just a thought.