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

The server could crash using views with GROUP BY [CORE3255] #3623

Closed
firebird-issue-importer opened this issue Nov 25, 2010 · 8 comments
Closed

Comments

@firebird-issue-importer

Submitted by: @asfernandes

Is related to QA450

I'll write details as a non public comment.

Commits: 67f9c9b a5b72a3 1388655 FirebirdSQL/fbt-repository@141b457

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Nov 25, 2010

Commented by: @dyemanov

When compiling a view, a literal is not cloned but just copied. Assign of impure space happens after the copy phase.

When a second request based on the view is compiled, impure space assigned on it changes the previosly created requests.

GROUP BY uses the impure space of expressions to store intermediate results.

Both things (not copy literals and usage of expressions impure space in GROUP BY) are a terrible thing IMO.

The following test case just demonstrates the problem.

-----------
connect 't.fdb'!

create table t1 (
n1 integer
)!

create view v1 (x, n1) as
select 'a', n1
from t1
group by 1, n1!

insert into t1 values (1)!
insert into t1 values (1)!
insert into t1 values (2)!
insert into t1 values (2)!
insert into t1 values (3)!

commit!

create or alter procedure p1 returns (x varchar(1), n1 integer)
as
begin
for select x, n1 from v1 into x, n1 do
suspend;
end!

create or alter procedure p2 returns (x varchar(1), n1 integer)
as
begin
for select n1 from t1 into n1 do
begin
end

for select n1, x from v1 into n1, x do
suspend;
end!

commit!

select * from p2!
select * from p1!

Statement failed, SQLCODE = -902
Error writing data to the connection.
-----------

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Nov 25, 2010

Commented by: @dyemanov

My plan to fix this issue in HEAD is to:
1) Make copy() a const function and never return this
2) Change the aggregate code to not use impure spaces of others expressions. For example, blr_value_if don't have impure space. It just don't crashs because it's always enclosed by a blr_cast when created in DSQL.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Nov 25, 2010

Modified by: @dyemanov

reporter: Dmitry Yemanov [ dimitr ] => Adriano dos Santos Fernandes [ asfernandes ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Feb 6, 2011

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Feb 9, 2011

Modified by: @asfernandes

Fix Version: 2.5.1 [ 10333 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Feb 24, 2011

Modified by: @pcisar

Link: This issue is related to QA450 [ QA450 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 4, 2013

Modified by: @pmakowski

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

Fix Version: 3.0 Alpha 1 [ 10331 ] =>

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 19, 2015

Modified by: @pavel-zotov

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

QA Status: Not enough information

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