Re: HAVING and column alias

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Mike Mascari" <mascarm(at)mascari(dot)com>
Cc: "PostgreSQL" <pgsql-general(at)postgresql(dot)org>
Subject: Re: HAVING and column alias
Date: 2003-02-22 15:56:18
Message-ID: 13928.1045929378@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Mike Mascari" <mascarm(at)mascari(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dima Tkach 2003-02-22 17:18:06 Re: optimizer bent on full table scan
Previous Message Tino Wildenhain 2003-02-22 15:28:31 Re: Representing a one to many join relationship as an