I wrote: > Dennis Bjorklund <[EMAIL PROTECTED]> writes: >> This testcase works in 7.3 but not in 7.4:
>> create table t1 (a int); >> create table t2 (b int); >> select * from t1, (select b as a from t2 group by a) as foo; > Another tweak we could make is to cause findTargetlistEntry() to look > only for local variable names before looking for targetlist alias > matches. This would effectively change the precedence for resolving > "GROUP BY x" to be (1) x as a local variable, (2) x as a targetlist > alias, (3) x as an outer variable; whereas the present search order is > (1), (3), (2). AFAICS this does not break compatibility with either > SQL92 or SQL99 because both of them allow only case (1). I've patched both 7.4 and HEAD branches to do things this way. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match