Support for using alias in having clause

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Support for using alias in having clause
Date: 2019-08-22 18:33:30
Message-ID: CAHOFxGpNO3dfV7r0++JLEDLceer_k04FSjUjrqH+E=wffNTz9g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Why can I use an alias for group by and order by and not for having? I am
just wondering if there is some barrier to it being implemented, or if it
just hasn't been.

select
table_schema || '.' || table_name AS schema_qualified_table_name,
count( column_name ) as column_count
from
information_schema.columns
group by
schema_qualified_table_name
having
count( column_name ) > 50 /* this works, but trying column_count > 50 does
not */
order by
column_count desc;

Browse pgsql-general by date

  From Date Subject
Next Message Jeremy Finzel 2019-08-22 18:46:18 How to use brin_summarize_range
Previous Message Igal @ Lucee.org 2019-08-22 18:29:44 How to install Postgres 12 beta with YUM