[GENERAL] Count column with name 'count' returns multiple rows. Why? - Mailing list pgsql-general

From Rob Audenaerde
Subject [GENERAL] Count column with name 'count' returns multiple rows. Why?
Date
Msg-id CAPz8bx1sf0vzncvYUiEJq9MDf9xvELi2tJLY2jTN=t=L68nSGA@mail.gmail.com
Whole thread Raw
Responses Re: [GENERAL] Count column with name 'count' returns multiple rows.Why?  (Justin Pryzby <pryzby@telsasoft.com>)
List pgsql-general
Hi all,

I don't understand why this query:

   select count(base.*) from mytable base;

does return multiple rows.

   select count(1) from mytable base;

returns the proper count.

There is a column with the name 'count'.

Can anyone please explain this behaviour?

Steps to reproduce:

create table s91("count" int);
insert into s91 values (1),(2),(3);
select count(base.*) from s91 base;

 count 
-------
     1
     2
     3
(3 rows)

I think this is either a bug or an undocumented feature?


ps. I posted this question on StackOverflow as well: https://stackoverflow.com/q/45752412/461499

pgsql-general by date:

Previous
From: Dan
Date:
Subject: [GENERAL] Number of rows affected by ON CASCADE
Next
From: Justin Pryzby
Date:
Subject: Re: [GENERAL] Count column with name 'count' returns multiple rows.Why?