Group by -- precedence question

From: Joe Van Dyk <joe(at)tanga(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Group by -- precedence question
Date: 2013-03-23 01:22:44
Message-ID: CACfv+pKq76+3Z4PZQV2yF=kL5_TEHBJABB0wqcaejYN=k1Q2WA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

begin;
create table f (v numeric);
insert into f values (1), (0.8);
select ceil(v) as v from f group by v;

-- sorta expected the result to be grouped by the column alias,
-- not by the in the table

v
───
1
1

This is the correct behavior, right? To group by the column alias, I'd have
to use "group by 1" or use a different name, right?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jov 2013-03-23 03:03:58 Re: Group by -- precedence question
Previous Message Alvaro Herrera 2013-03-22 23:12:02 Re: DROP OWNED BY fails to drop privileges granted by non-owners (was Re: [GENERAL] Bug, Feature, or what else?)