Adding missing FROM clause - thanks or no thanks?

From: John Siracusa <siracusa(at)mindspring(dot)com>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Adding missing FROM clause - thanks or no thanks?
Date: 2004-01-27 18:00:15
Message-ID: BC3C115F.2754C%siracusa@mindspring.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I recently had a problem where a bunch of postgres backends were taking up
huge amounts of CPU time. I found a bunch of log messages like this:

NOTICE: adding missing FROM-clause entry for table "b"

Which I eventually tracked to an improperly constructed query that reduced
to something like this:

select a1, a2 FROM a WHERE a1 = '...' AND b.b1 = '...';

Table b is pretty big and the conditions were such that it was (apparently)
doing a join of every row in a with every possible row of b. That's
certainly now what I wanted.

Anyway, I fixed the query construction bug, but I have a question: is this
"adding missing FROM-clause entry" behavior part of the SQL standard(s) or a
"feature" of Postgres? Prior to seeing this, I'd have expected a query like
the above to cause a fatal error in the parsing stage. Put another way, can
someone give me an example of when this behavior is useful or desirable?

-John

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thapliyal, Deepak 2004-01-27 18:26:35 Postgress resumes ...
Previous Message Tom Lane 2004-01-27 17:27:31 Re: Recursive optimization of IN subqueries