Issue Details (XML | Word | Printable)

Key: CORE-4322
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Pavel Zotov
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Engine crashes when use aggregate or window functions in recursive query

Created: 21/Jan/14 07:43 PM   Updated: 23/Sep/15 12:43 PM
Component/s: None
Affects Version/s: 2.5.2, 2.5.2 Update 1, 3.0 Alpha 1, 3.0 Alpha 2
Fix Version/s: 3.0 Beta 1

File Attachments: 1. Zip Archive gdb-firebird.140121_234028.1.zip (7 kB)

Issue Links:
Relate
 

QA Status: Done successfully


 Description  « Hide
LI-T3.0.0.30813

SQL> with recursive r as(select 0 i,count(*)over() c from rdb$database union all select r.i+1,sum(i)over() from r where r.i<10) select * from r;

Select Expression
    -> Recursion
        -> Materialize
            -> Window
                -> Record Buffer
                    -> Table "R RDB$DATABASE" Full Scan
        -> Materialize
            -> Filter

           I C
============ =====================
Statement failed, SQLSTATE = 08006
Error reading data from the connection.

Coredump see in attach.

Edit:

2.5:

with recursive r as(select 0 i, count(*) c from rdb$database union all select r.i + 1, sum(i) from r where r.i < 10) select * from r;

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Pavel Zotov made changes - 21/Jan/14 07:43 PM
Field Original Value New Value
Attachment gdb-firebird.140121_234028.1.zip [ 12413 ]
Adriano dos Santos Fernandes made changes - 21/Jan/14 11:35 PM
Assignee Adriano dos Santos Fernandes [ asfernandes ]
Adriano dos Santos Fernandes added a comment - 22/Jan/14 02:50 PM - edited
.

Adriano dos Santos Fernandes made changes - 22/Jan/14 02:50 PM
Summary Engine crashes when use SUM()OVER() in recursive query Engine crashes when use aggregate or window functions in recursive query
Affects Version/s 3.0 Alpha 1 [ 10331 ]
Affects Version/s 2.5.2 Update 1 [ 10521 ]
Affects Version/s 2.5.2 [ 10450 ]
Affects Version/s 3.0 Alpha 2 [ 10560 ]
Adriano dos Santos Fernandes made changes - 22/Jan/14 02:52 PM
Description LI-T3.0.0.30813

SQL> with recursive r as(select 0 i,count(*)over() c from rdb$database union all select r.i+1,sum(i)over() from r where r.i<10) select * from r;

Select Expression
    -> Recursion
        -> Materialize
            -> Window
                -> Record Buffer
                    -> Table "R RDB$DATABASE" Full Scan
        -> Materialize
            -> Filter

           I C
============ =====================
Statement failed, SQLSTATE = 08006
Error reading data from the connection.

Coredump see in attach.
LI-T3.0.0.30813

SQL> with recursive r as(select 0 i,count(*)over() c from rdb$database union all select r.i+1,sum(i)over() from r where r.i<10) select * from r;

Select Expression
    -> Recursion
        -> Materialize
            -> Window
                -> Record Buffer
                    -> Table "R RDB$DATABASE" Full Scan
        -> Materialize
            -> Filter

           I C
============ =====================
Statement failed, SQLSTATE = 08006
Error reading data from the connection.

Coredump see in attach.

Edit:

2.5:

with recursive r as(select 0 i, count(*) c from rdb$database union all select r.i + 1, sum(i) from r where r.i < 10) select * from r;
Adriano dos Santos Fernandes added a comment - 27/Jan/14 01:01 AM
Another related problem: aggregate functions usage are not verified correctly.

-- Compiles, but should give an error.
with recursive r as(select 0 i,count(*) c from rdb$database union all select r.i + 1, 0 from r where sum(r.i) = 0) select * from r;

Adriano dos Santos Fernandes added a comment - 27/Jan/14 01:10 AM
I'm fixing this only in 3.0 for now. Will see about backport after fix review.

Adriano dos Santos Fernandes made changes - 27/Jan/14 01:10 AM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0 Beta 1 [ 10332 ]
Resolution Fixed [ 1 ]
Pavel Cisar made changes - 29/Mar/14 05:51 PM
Link This issue is related to QA-588 [ QA-588 ]
Pavel Zotov made changes - 29/May/15 09:39 PM
Status Resolved [ 5 ] Resolved [ 5 ]
QA Status Done successfully
Pavel Cisar added a comment - 23/Sep/15 12:43 PM
Test created.

Pavel Cisar made changes - 23/Sep/15 12:43 PM
Status Resolved [ 5 ] Closed [ 6 ]