pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14974: count doesn't accept text columns
3+ messages / 3 participants
[nested] [flat]

* BUG #14974: count doesn't accept text columns
@ 2017-12-14 12:33 jarek.stoklosa@gmail.com
  2017-12-14 12:47 ` Re: BUG #14974: count doesn't accept text columns Marko Tiikkaja <marko@joh.to>
  0 siblings, 1 reply; 3+ messages in thread

From: jarek.stoklosa@gmail.com @ 2017-12-14 12:33 UTC (permalink / raw)
  To: pgsql-bugs; +Cc: jarek.stoklosa@gmail.com

The following bug has been logged on the website:

Bug reference:      14974
Logged by:          Jarosław Stokłosa
Email address:      jarek.stoklosa@gmail.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"




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #14974: count doesn't accept text columns
  2017-12-14 12:33 BUG #14974: count doesn't accept text columns jarek.stoklosa@gmail.com
@ 2017-12-14 12:47 ` Marko Tiikkaja <marko@joh.to>
  2017-12-14 12:56   ` Re: BUG #14974: count doesn't accept text columns Jarosław Stokłosa <jarek.stoklosa@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Marko Tiikkaja @ 2017-12-14 12:47 UTC (permalink / raw)
  To: jarek.stoklosa@gmail.com; +Cc: pgsql-bugs

On Thu, Dec 14, 2017 at 2:33 PM, <jarek.stoklosa@gmail.com> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      14974
> Logged by:          Jarosław Stokłosa
> Email address:      jarek.stoklosa@gmail.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
>

Works just fine here.


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

Are you sure you don't have a poorly-named "count" function defined?
What's the output of:

    \df *.count

from psql?


.m

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #14974: count doesn't accept text columns
  2017-12-14 12:33 BUG #14974: count doesn't accept text columns jarek.stoklosa@gmail.com
  2017-12-14 12:47 ` Re: BUG #14974: count doesn't accept text columns Marko Tiikkaja <marko@joh.to>
@ 2017-12-14 12:56   ` Jarosław Stokłosa <jarek.stoklosa@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Jarosław Stokłosa @ 2017-12-14 12:56 UTC (permalink / raw)
  To: Marko Tiikkaja <marko@joh.to>; +Cc: pgsql-bugs

Correct.
Thank you.
Regards
Jarek

14.12.2017 13:47 "Marko Tiikkaja" <marko@joh.to> napisał(a):

> On Thu, Dec 14, 2017 at 2:33 PM, <jarek.stoklosa@gmail.com> wrote:
>
>> The following bug has been logged on the website:
>>
>> Bug reference:      14974
>> Logged by:          Jarosław Stokłosa
>> Email address:      jarek.stoklosa@gmail.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
>>
>
> Works just fine here.
>
>
>> select t, count(distinct tt) from test group by t;
>> gives "DISTINCT specified, but count is not an aggregate function"
>>
>
> Are you sure you don't have a poorly-named "count" function defined?
> What's the output of:
>
>     \df *.count
>
> from psql?
>
>
> .m
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-12-14 12:56 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-12-14 12:33 BUG #14974: count doesn't accept text columns jarek.stoklosa@gmail.com
2017-12-14 12:47 ` Marko Tiikkaja <marko@joh.to>
2017-12-14 12:56   ` Jarosław Stokłosa <jarek.stoklosa@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox