pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: 253540651@qq.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17152: ERROR: AddressSanitizer: SEGV on unknown address
Date: Wed, 18 Aug 2021 11:36:00 -0400
Message-ID: <1431890.1629300960@sss.pgh.pa.us> (raw)
In-Reply-To: <17152-c7f906cc1a88e61b@postgresql.org>
References: <17152-c7f906cc1a88e61b@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> [ unreadable example ]

This can be boiled down to

CREATE TEMP TABLE v0 ( v2 int );
INSERT INTO v0 VALUES (1);

SELECT (
 SELECT
  MODE ( ) WITHIN GROUP ( ORDER BY v2 )
    FILTER ( WHERE MODE ( ) WITHIN GROUP ( ORDER BY v2 > 0 ) )
)
FROM v0;

It seems fairly clear to me that this ought to be rejected as invalid,
because we don't allow aggregates within the arguments of aggregates.
That does happen without the sub-select:

regression=# SELECT
regression-#   MODE ( ) WITHIN GROUP ( ORDER BY v2 )
regression-#     FILTER ( WHERE MODE ( ) WITHIN GROUP ( ORDER BY v2 > 0 ) )
regression-# FROM v0;
ERROR:  aggregate functions are not allowed in FILTER
LINE 3:     FILTER ( WHERE MODE ( ) WITHIN GROUP ( ORDER BY v2 > 0 )...
                           ^

So somehow the fact that outer references are involved is misleading that
error check.  I've not traced it further than that.

			regards, tom lane





view thread (5+ messages)  latest in thread

Message-ID: <1431890.1629300960@sss.pgh.pa.us>
Permalink:  ../1431890.1629300960@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1431890.1629300960@sss.pgh.pa.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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, 253540651@qq.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17152: ERROR: AddressSanitizer: SEGV on unknown address
  In-Reply-To: <1431890.1629300960@sss.pgh.pa.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