<[EMAIL PROTECTED]> writes: > /* > * The sub-select must not refer to any Vars of the parent query. > * (Vars of higher levels should be okay, though.) > */ > if (contain_vars_of_level((Node *) subselect, 1)) > return NULL;
> By commenting this code region I was able to optimize several correlated > subqueries. It's only pure luck that your test case still produces the right answer. The IN code depends on the assumption that the sub-SELECT is independent of the outer query. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq