seems column(alias_name) is a valid syntax? I cant find anything alike in docs

From: Vladimir Svedov <vodevsh(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: seems column(alias_name) is a valid syntax? I cant find anything alike in docs
Date: 2017-08-18 10:52:00
Message-ID: CADqDLE-+wsBAms6WcjwXsrzKDZpi3gKuN04xAwU-EiSiVXzeGA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,
Sorry If bother you again for no reason. Was surprised by behaviour
described in

https://stackoverflow.com/questions/45752412/count-column-with-name-count-returns-multiple-rows-why/45753374?noredirect=1#comment78464299_45753374

Quite soon found out that column_name(alias_name) seems a valid syntax,
below a(c) works - is it a feature? I could not find it anywhere in docs.

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

Why would I use such syntax in first place? as described in SO original
post, he has a column named "count" and thus

> select count(table_name.*) from table_name

returns column "count" instead of number of rows. I can't tell why would
you name column with function name.

So please help finding the docs and understanding why it works.

Thank you

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Kapila 2017-08-18 10:52:04 Re: [HACKERS] [postgresql 10 beta3] unrecognized node type: 90
Previous Message somda3florent 2017-08-18 09:13:07 BUG #14783: The ODBC administration tool crashes when I configure 64-bit pgsqlOdbc