Robert Treat <[EMAIL PROTECTED]> writes:
> ... but I have to wonder, if we have established f1 by the time
> we evaluate the group by, shouldn't we also be able to determine f1 at having
> time, and therefore allow alias in having in this instance?
The key point is that we only allow output-li
On Tuesday 13 May 2008 18:43:25 Tom Lane wrote:
> "Scott Marlowe" <[EMAIL PROTECTED]> writes:
> > On Tue, May 13, 2008 at 3:43 PM, Nathan Thatcher <[EMAIL PROTECTED]>
wrote:
> >> I am in the middle of switching a bunch of queries over from MySQL to
> >> PostgreSQL and have hit a little snag. The f
Thank you all for the insight. PG is obviously my first choice (that
is why I am switching)... the hope is to do so without having to
change everything. Thanks for the solution David - it did the trick.
Nate
On Tue, May 13, 2008 at 5:01 PM, David Wilson <[EMAIL PROTECTED]> wrote:
> On Tue, May 13
On Tue, May 13, 2008 at 5:43 PM, Nathan Thatcher <[EMAIL PROTECTED]> wrote:
> Is this the correct way to do this, or is there a better way / a way
> to get PostgreSQL to recognize an alias in the HAVING clause?
As Tom pointed out, f1's not in scope for the HAVING clause. If you're
that concerned a
"Scott Marlowe" <[EMAIL PROTECTED]> writes:
> On Tue, May 13, 2008 at 3:43 PM, Nathan Thatcher <[EMAIL PROTECTED]> wrote:
>> I am in the middle of switching a bunch of queries over from MySQL to
>> PostgreSQL and have hit a little snag. The following query works fine
>> in MySQL but raises an error
On Tue, May 13, 2008 at 4:18 PM, Scott Marlowe <[EMAIL PROTECTED]> wrote:
> On Tue, May 13, 2008 at 3:43 PM, Nathan Thatcher <[EMAIL PROTECTED]> wrote:
>> I am in the middle of switching a bunch of queries over from MySQL to
>> PostgreSQL and have hit a little snag. The following query works fine
>
On Tue, May 13, 2008 at 3:43 PM, Nathan Thatcher <[EMAIL PROTECTED]> wrote:
> I am in the middle of switching a bunch of queries over from MySQL to
> PostgreSQL and have hit a little snag. The following query works fine
> in MySQL but raises an error in postgres:
>
> SELECT COUNT(*), id % 3 AS f1 F
Oops, that second query should be
SELECT COUNT(*), id % 3 AS f1 FROM table GROUP BY f1 HAVING id % 3 <> 0;
On Tue, May 13, 2008 at 3:43 PM, Nathan Thatcher <[EMAIL PROTECTED]> wrote:
> I am in the middle of switching a bunch of queries over from MySQL to
> PostgreSQL and have hit a little snag.
I am in the middle of switching a bunch of queries over from MySQL to
PostgreSQL and have hit a little snag. The following query works fine
in MySQL but raises an error in postgres:
SELECT COUNT(*), id % 3 AS f1 FROM table GROUP BY f1 HAVING f1 <> 0;
It seems that Postgres does not recognize the