Subject: quel statement phrasing

From: David Feldcamp <[email-masked]>
Date: Wed, 6 May 92 11:30:21 -0700

I have again run into a problem where quel statement phrasing seems to make the
difference between a statement that works and a statement that doesn't work
(the backend never responds), although both statements are syntactically valid and
logically equivalent.  This has happened in several other cases, but I just wrote them
off as quirks of some sort, but this is happening too frequently...  Here is the
latest example:

-------

* delete edge where (node.kind = 445) and (node.pid = 1149) and (node.name = graph.node) and (node.pid = graph.pid) and (graph.edge = edge.name) and (node.pid = graph.pid)\g

Query sent to backend is "delete edge where (node.kind = 445) and (node.pid = 1149) and (node.name = graph.node) and (node.pid = graph.pid) and (graph.edge = edge.name) and (node.pid = graph.pid)"
DELETE
Go 
* delete edge where (node.kind = 445) and (node.pid = 1149) and (graph.node = node.name) and (graph.pid = node.pid) and (edge.name = graph.edge) and (edge.pid = node.pid)\g

Query sent to backend is "delete edge where (node.kind = 445) and (node.pid = 1149) and (graph.node = node.name) and (graph.pid = node.pid) and (edge.name = graph.edge) and (edge.pid = node.pid)"
Error: No response from the backend, exiting...

-------

The data in the database was such that in NEITHER case was there any data that met the
deletion criteria (although this doesn't seem to make a difference).

In the second statement, am I violating some QUEL rule not stated in the documentation?
Is there a known problem with certain ways of phrasing statements (e.g., field ordering
in multiple joins - which I have assumed until now is optimized automatically by the 
Postgres optimizer/planner)?

---

From: postarch (Postgres Mailing Archive)
Date: Tue, 26 May 92 21:48:49 PDT

you write:

> I have again run into a problem where quel statement phrasing seems
> to make the difference between a statement that works and a statement
> that doesn't work (the backend never responds), although both statements
> are syntactically valid and logically equivalent.

> In the second statement, am I violating some QUEL rule not stated in
> the documentation?  Is there a known problem with certain ways of
> phrasing statements (e.g., field ordering in multiple joins - which
> I have assumed until now is optimized automatically by the Postgres
> optimizer/planner)?

no, you're not doing anything wrong; the optimizer should generate valid
(and equivalent) plans from either of the queries you supply.  i was unable
to duplicate the behavior you describe here.  could you send me the schema
that you're using?

also, i note that your two queries are not actually equivalent:

    delete edge where (node.kind = 445) and (node.pid = 1149)
	and (node.name = graph.node) and (node.pid = graph.pid)
	and (graph.edge = edge.name) and (node.pid = graph.pid)\g

    delete edge where (node.kind = 445) and (node.pid = 1149)
	and (graph.node = node.name) and (graph.pid = node.pid)
	and (edge.name = graph.edge) and (edge.pid = node.pid)\g

in the first, the final qualification is (node.pid = graph.pid); in
the second, it's (edge.pid = node.pid).  is this difference significant,
or is it just a typo in your message?

if you send me the schema you're using when you see this problem, i'll
see if i can duplicate it here.
					mike olson
					project sequoia 2000
					uc berkeley
					[email-masked]