Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Engine crashes when use aggregate or window functions in recursive query [CORE4322] #4645

Closed
firebird-automations opened this issue Jan 21, 2014 · 12 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

Is related to QA588

Attachments:
gdb-firebird.140121_234028.1.zip

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;

Commits: d7550f6 9350f94 FirebirdSQL/fbt-repository@b540d6a FirebirdSQL/fbt-repository@41e5847

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

Attachment: gdb-firebird.140121_234028.1.zip [ 12413 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Version: 3.0 Alpha 1 [ 10331 ]

Version: 2.5.2 Update 1 [ 10521 ]

Version: 2.5.2 [ 10450 ]

Version: 3.0 Alpha 2 [ 10560 ]

summary: Engine crashes when use SUM()OVER() in recursive query => Engine crashes when use aggregate or window functions in recursive query

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

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;

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

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;

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

I'm fixing this only in 3.0 for now. Will see about backport after fix review.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Beta 1 [ 10332 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA588 [ QA588 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Done successfully

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

Test created.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment