HAVING clause working in postgres 8.0, but not in 8.2

From: ujkavlade(at)gmail(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: HAVING clause working in postgres 8.0, but not in 8.2
Date: 2007-07-02 13:06:11
Message-ID: 1183381571.227544.144240@n60g2000hse.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello all,

We have recently upgrade our postgres server from 8.0 to 8.2. I am
experiencing some difficulties in SQL queries.
Let's say I have a table NUMBERS (number (integer)) which has values
1, 5 and 8.

SELECT number FROM numbers; will return 1, 5 and 8.

In PostgreSql 8.0, SELECT number FROM numbers HAVING number = 5;
returns 5

But in 8.2, it gives me the following error: ERROR: column
"numbers.number" must appear in the GROUP BY clause or be used in an
aggregate function.

In the documentation, it says that HAVING can be used without GROUP BY
or aggregate functions.

Has anybody already experienced this, is this a bug or am I missing
something?

TIA,
Vladimir

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jason L. Buberel 2007-07-02 13:20:27 Re: recovery_target_time ignored or recovery alwaysrecovers to end of WAL
Previous Message Dimitri Fontaine 2007-07-02 12:41:56 Re: importing limited set of rows/tuples