Re: Possibly Incorrect Data Return

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: jwwfou(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Possibly Incorrect Data Return
Date: 2022-11-23 18:24:15
Message-ID: Y35lT8xeiQRjzdd9@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Tue, Nov 8, 2022 at 05:22:24PM -0500, Tom Lane wrote:
> PG Doc comments form <noreply(at)postgresql(dot)org> writes:
> > Hello: I am working through the tutorial and the Doc page says the row count
> > is 5 but my results show 0 records. Of course, I may be doing something
> > wrong, too:
>
> > jwjwj=# SELECT city, max(temp_lo), count(*) FILTER (WHERE temp_lo < 30)
> > FROM weather
> > GROUP BY city
> > HAVING max(temp_lo) < 40;
> > city | max | count
> > ---------+-----+-------
> > Hayward | 37 | 0
> > (1 row)
>
> No, you're right, given the sample data shown earlier then count = 0
> is what you would get. Somebody injected this FILTER example without
> a lot of thought, it would appear, as not only does the output not
> match but it's completely disjointed from the flow of explanation
> (IMO anyway). This example originally introduced only HAVING, and
> trying to make it do double duty just confuses things. A fully
> separate example of FILTER would have served better.
>
> I'll go do something about that --- thanks for the report!

Sorry, that was me, and I thought I checked it, but obviously
incorrectly, thanks.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

Indecision is a decision. Inaction is an action. Mark Batterson

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2022-11-23 19:43:03 Re: temporary file size clarification
Previous Message Boboc Cristi 2022-11-23 09:03:05 Re: Logical replication missing information