Re: BUG #17067: FailedAssertion at castNodeImpl
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: cyg0810@gmail.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2021-06-21T10:09:57Z
Lists: pgsql-bugs
On Mon, Jun 21, 2021 at 5:48 PM David Rowley <dgrowleyml@gmail.com> wrote:
> On Mon, 21 Jun 2021 at 20:15, PG Bug reporting form
> <noreply@postgresql.org> wrote:
> > run the following sql command through client and the PostgreSQL database
> > process will crash:
> >
> > CREATE TABLE v0 ( v1 FLOAT NOT NULL PRIMARY KEY ) ;
> > WITH v1 AS ( DELETE FROM v0 WHERE v1 <= - - - 9 RETURNING * ) INSERT
> INTO v0
> > VALUES ( - - - - - - 95 ) ;
> > SELECT v1 FROM ( SELECT * FROM v0 UNION ALL SELECT * FROM v0 GROUP BY
> > DISTINCT ROLLUP ( v1 , v1 ) , ROLLUP ( v1 , USER ) , GROUPING SETS ( ROW
> ( )
> > , ( v1 ) ) , ROLLUP ( v1 < - - 61 AND v1 IN ( -2147483648 , - 94 ) , v1
> ) )
> > v1 ORDER BY ( v1 + - - -1 ) , ( v1 + - - v1 IN ( SELECT v1 FALSE FROM (
> > SELECT FROM v0 GROUP BY v1 ) PRECISION ) ) ;
>
> Thanks for the report. It looks like a thinko in 1d581ce71. Code
> was added there which insists the initial list element is a List, but
> it's an IntList. I think the code should just use linitial instead of
> linitial_node.
>
> I'm quite surprised that we don't have a test that picks this up.
>
A distinct group by clause would help to reveal this issue as:
explain select * from t GROUP BY distinct a, rollup(b);
Maybe we can add a test case to cover it.
Thanks
Richard
Commits
-
Fix assert failure in expand_grouping_sets
- 8d29d45d9b3c 14.0 landed