Re: BUG #17067: FailedAssertion at castNodeImpl - Mailing list pgsql-bugs

From Richard Guo
Subject Re: BUG #17067: FailedAssertion at castNodeImpl
Date
Msg-id CAMbWs4_iRT7BDQovtX9Eihu=UDh4G6hRDOpm=piBtSUm+5Oodw@mail.gmail.com
Whole thread Raw
In response to Re: BUG #17067: FailedAssertion at castNodeImpl  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: BUG #17067: FailedAssertion at castNodeImpl
List 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

pgsql-bugs by date:

Previous
From: David Rowley
Date:
Subject: Re: BUG #17067: FailedAssertion at castNodeImpl
Next
From: David Rowley
Date:
Subject: Re: BUG #17067: FailedAssertion at castNodeImpl