Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!van-bc!tacitus!clh
From: clh@tacitus.tfic.bc.ca (Chris Hermansen)
Newsgroups: comp.databases
Subject: Re: Parsing Query Languages in the Client or Server
Message-ID: <112@tacitus.tfic.bc.ca>
Date: 28 Sep 89 22:37:27 GMT
References: <641@daitc.daitc.mil> <6333@sybase.sybase.com>
Reply-To: clh@tacitus.UUCP (Chris Hermansen)
Organization: Timberline Forest Inventory Consultants, Vancouver BC
Lines: 45

In article <6333@sybase.sybase.com> jeffl@sybase.Sybase.COM (Jeff Lichtman) writes:
>
>I assume, by the way, that we're not talking about validating the user's
>query just so we can send the unmodified text of that query to the server.
>That would be a terrible way of doing it.  In that case, the server would
>still have to validate the query once the front end decided it was safe
>to send, so in the best case, the validations would be costly, and in the
>worst case, they would have to be done twice.  We're still talking about
>sending parse trees across the network, aren't we?

First, a disclaimer:  I'm just a poor schmuck user of databases, not a high-
powered designer...

In your argument above about `pre-validating' queries at the front end,
the server will have to re-validate things anyway, UNLESS the server
locks `mytable' in some sense to prevent alterations, etc. etc. coming down
another wire while the original process is ruminating over the results.

For example, suppose dbclient1 sends some queries to the system catalogs
on dbserver, for the purposes of verifying the semantics of a specific chunk
of sql dealing with `mytable'.

When the response comes back, dbclient1 is busy with another task that results
in a delay of, say, two seconds before the (client) validated sql is sent back
to dbserver.  Meanwhile, dbclient2 sends a request to dbserver to, say, change
the name of column `mycolumn' in table `mytable' to `foo'.  Next, dbserver
receives a (client) validated request to select a bunch of rows displaying
`mycolumn' from `mytable'.  What happens?

I claim that `mytable' cannot be locked, since dbserver doesn't know that
a request will be coming from dbclient1 for `mytable'.  All it knows is that
dbclient1 wants some info from the system catalogs.

It seems to me that the logical conclusion here is that anything more than
syntactic validation at the server is a waste of time, at least if there
are any possibilities of table modification between the validation and
request for information phases.

Please see disclaimer above...

Chris Hermansen                         Timberline Forest Inventory Consultants
Voice: 1 604 733 0731                   302 - 958 West 8th Avenue
FAX:   1 604 733 0634                   Vancouver B.C. CANADA
uunet!ubc-cs!van-bc!tacitus!clh         V5Z 1E5
 or Chris_Hermansen@mtsg.ubc.ca