On 2016/03/09 5:39 PM, Jean-Christophe Deschamps wrote:
>
> Sorry guys, I don't know why I wrote that. In fact I know: I shouldn't 
> be talking over the phone while reading the list.
>
> Of course I use correlated subqueries a lot, but never had to 
> re-select a column from the enclosing query. Indeed, I'd say that most 
> of the time one uses columns from enclosing query as expressions, e.g. 
> in comparison operators or functions in a where clause.

Any column reference is indeed an expression, whether in a main or sub 
query, but I agree on the very typical WHERE clause locality for such 
queries.


>
> The OP query is pretty uncommon since it's guaranteed to produce an 
> empty result, hence it's no surprise that the bug was so old.

This is very true, and I propose that the only reason the OP even found 
the bug is that he made a mistake when designing the query, and when 
tracing the steps and finding the mistake, mused over how he got any 
output from it at all - then thinking it should have produced an Error 
condition, hence posting the question. He would probably still be 
surprised to learn that the syntax is indeed valid with the bug being 
even more obscure than might be imagined. (I could be very wrong though).

I myself thought this was a duplicate of a bug found some time ago in 
which the rowid in a sub query was misunderstood also producing wrong 
answers, but that was due to automatic indexing and was fixed back in 3.9.2.

Reply via email to