sql - Count column with name 'count' returns multiple rows. Why? -


i don't understand why query:

select count(base.*) mytable base;

does return multiple rows.

select count(1) mytable base;

returns proper count.

there column name count.

can please explain behaviour?

here information schema:

table_catalog,table_schema,table_name,column_name,ordinal_position,column_default,is_nullable,data_type,character_maximum_length,character_octet_length,numeric_precision,numeric_precision_radix,numeric_scale,datetime_precision,interval_type,interval_precision,character_set_catalog,character_set_schema,character_set_name,collation_catalog,collation_schema,collation_name,domain_catalog,domain_schema,domain_name,udt_catalog,udt_schema,udt_name,scope_catalog,scope_schema,scope_name,maximum_cardinality,dtd_identifier,is_self_referencing,is_identity,identity_generation,identity_start,identity_increment,identity_maximum,identity_minimum,identity_cycle,is_generated,generation_expression,is_updatable mydatabase,vcs,mytable,controlepunt,1,,yes,text,,1073741824,,,,,,,,,,,,,,,,mydatabase,pg_catalog,text,,,,,1,no,no,,,,,,,never,,yes mydatabase,vcs,mytable,norm,2,,yes,text,,1073741824,,,,,,,,,,,,,,,,mydatabase,pg_catalog,text,,,,,2,no,no,,,,,,,never,,yes mydatabase,vcs,mytable,fout,3,,yes,text,,1073741824,,,,,,,,,,,,,,,,mydatabase,pg_catalog,text,,,,,3,no,no,,,,,,,never,,yes mydatabase,vcs,mytable,count,4,,yes,bigint,,,64,2,0,,,,,,,,,,,,,mydatabase,pg_catalog,int8,,,,,4,no,no,,,,,,,never,,yes mydatabase,vcs,mytable,id,5,,yes,bigint,,,64,2,0,,,,,,,,,,,,,mydatabase,pg_catalog,int8,,,,,5,no,no,,,,,,,never,,yes 

it's not answer - using extend samples op. seems not related aggregation functions:

t=# create table s91("count" int); create table time: 38.981 ms t=# insert s91 values (1),(2),(3); insert 0 3 time: 13.929 ms t=# select count(base.*) s91 base;  count  -------      1      2      3 (3 rows)  t=# alter table s91 rename column "manah_manah"; alter table time: 1.025 ms t=# select manah_manah(s91.*) s91;  manah_manah  -------------            1            2            3 (3 rows) 

update: seems column(alias_name) valid syntax:

s=# c(a,b) (values(1,2),(2,3)) select a(c),(c).a c;  |  ---+---  1 | 1  2 | 2 (2 rows) 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -