Bug in 3.25.2 (RECURSIVE CTE + window function)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug in 3.25.2 (RECURSIVE CTE + window function)

Щекин Ярослав
Hello.

Here's the self-contained test case:

WITH t(id, parent) AS (
SELECT CAST(1 AS INT), CAST(NULL AS INT)
UNION ALL
SELECT 2, NULL
UNION ALL
SELECT 3, 1
UNION ALL
SELECT 4, 1
UNION ALL
SELECT 5, 2
UNION ALL
SELECT 6, 2
), q AS (
SELECT t.*, ROW_NUMBER() OVER (ORDER BY t.id) AS rn
  FROM t
 WHERE parent IS NULL
 UNION ALL
SELECT t.*, ROW_NUMBER() OVER (ORDER BY t.id) AS rn
  FROM q
  JOIN t
    ON t.parent = q.id
)
SELECT *
  FROM q;

Results in segmentation fault.
(I also wanted to thank [Arfrever] (in #sqlite IRC) for testing / confirmation.)

-- 
WBR, Yaroslav Schekin.

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Bug in 3.25.2 (RECURSIVE CTE + window function)

Richard Hipp-3
Thanks for the report and test case.  Now fixed on trunk and on branch-3.25.

On 9/25/18, Щекин Ярослав <[hidden email]> wrote:

> Hello.
>
> Here's the self-contained test case:
>
> WITH t(id, parent) AS (
> SELECT CAST(1 AS INT), CAST(NULL AS INT)
> UNION ALL
> SELECT 2, NULL
> UNION ALL
> SELECT 3, 1
> UNION ALL
> SELECT 4, 1
> UNION ALL
> SELECT 5, 2
> UNION ALL
> SELECT 6, 2
> ), q AS (
> SELECT t.*, ROW_NUMBER() OVER (ORDER BY t.id) AS rn
>   FROM t
>  WHERE parent IS NULL
>  UNION ALL
> SELECT t.*, ROW_NUMBER() OVER (ORDER BY t.id) AS rn
>   FROM q
>   JOIN t
>     ON t.parent = q.id
> )
> SELECT *
>   FROM q;
>
> Results in segmentation fault.
> (I also wanted to thank [Arfrever] (in #sqlite IRC) for testing /
> confirmation.)
>
> --
> WBR, Yaroslav Schekin.
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users