pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: jwwfou@gmail.com
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: Possibly Incorrect Data Return
Date: Wed, 23 Nov 2022 13:24:15 -0500
Message-ID: <Y35lT8xeiQRjzdd9@momjian.us> (raw)
In-Reply-To: <3869389.1667946144@sss.pgh.pa.us>
References: <166794307526.652.9073408178177444190@wrigleys.postgresql.org>
	<3869389.1667946144@sss.pgh.pa.us>

On Tue, Nov  8, 2022 at 05:22:24PM -0500, Tom Lane wrote:
> PG Doc comments form <noreply@postgresql.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@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

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






view thread (3+ messages)

Message-ID: <Y35lT8xeiQRjzdd9@momjian.us>
Permalink:  ../Y35lT8xeiQRjzdd9@momjian.us/
Also on:    postgresql.org/message-id/Y35lT8xeiQRjzdd9@momjian.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: bruce@momjian.us, tgl@sss.pgh.pa.us, jwwfou@gmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: Possibly Incorrect Data Return
  In-Reply-To: <Y35lT8xeiQRjzdd9@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox