BUG #14974: count doesn't accept text columns

From: jarek(dot)stoklosa(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Cc: jarek(dot)stoklosa(at)gmail(dot)com
Subject: BUG #14974: count doesn't accept text columns
Date: 2017-12-14 12:33:37
Message-ID: 20171214123337.29869.77621@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14974
Logged by: Jarosław Stokłosa
Email address: jarek(dot)stoklosa(at)gmail(dot)com
PostgreSQL version: 9.6.6
Operating system: Linux
Description:

create table test (t TEXT, tt TEXT);
insert into test values('a', 'b');
insert into test values('a', null::TEXT);
select t, count(tt) from test group by t;

Should be (a, 1) but I've got a error message:
column "test.tt" must appear in the GROUP BY clause or be used in an
aggregate function

select t, count(distinct tt) from test group by t;
gives "DISTINCT specified, but count is not an aggregate function"

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Marko Tiikkaja 2017-12-14 12:47:34 Re: BUG #14974: count doesn't accept text columns
Previous Message skaurus 2017-12-14 12:31:08 BUG #14973: hung queries