Re: HAVING and column alias - Mailing list pgsql-general

From Tom Lane
Subject Re: HAVING and column alias
Date
Msg-id 13928.1045929378@sss.pgh.pa.us
Whole thread Raw
In response to Re: HAVING and column alias  ("Mike Mascari" <mascarm@mascari.com>)
List pgsql-general
"Mike Mascari" <mascarm@mascari.com> writes:
> Okay. I'll have to upgrade, then. Repeating the sub-SELECT in
> the HAVING clause generated that same error that I reported
> earlier when two sub-SELECTs in the target list are identical in
> version 7.2.1.

On looking at the code, I realize that this behavior probably changed
as of this post-7.3 patch:

2003-01-16 22:25  tgl

    * src/: backend/optimizer/plan/planner.c,
    backend/optimizer/util/clauses.c, backend/parser/analyze.c,
    backend/parser/parse_agg.c, include/optimizer/clauses.h,
    include/parser/parse_agg.h: Fix parse_agg.c to detect ungrouped
    Vars in sub-SELECTs; remove code that used to do it in planner.
    That was an ancient kluge that was never satisfactory; errors
    should be detected at parse time when possible.  But at the time we
    didn't have the support mechanism (expression_tree_walker et al) to
    make it convenient to do in the parser.

So I was mistaken to tell you that it's fixed in 7.3.*.
Sorry about that...

            regards, tom lane

pgsql-general by date:

Previous
From: Tino Wildenhain
Date:
Subject: Re: Representing a one to many join relationship as an
Next
From: Dima Tkach
Date:
Subject: Re: optimizer bent on full table scan