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

set autoddl off and sequence of: ( create view V as select * from T; alter view V as select 1 x from rdb$database; drop view V; ) leads to server crash [CORE5107] #5391

Closed
firebird-issue-importer opened this issue Feb 6, 2016 · 6 comments

Comments

@firebird-issue-importer
Copy link

firebird-issue-importer commented Feb 6, 2016

Submitted by: @pavel-zotov

Attachments:
gdb-crash-when-create_alter_drop_view-within-single-tx.zip

Create file with following statements:

$ /opt/fb30ss/bin/isql -q -i ./create-alter-drop-view-when-autoddl-off.sql
set autoddl off;
commit;
recreate table test(id int, x int);
create view v_test as select * from test;
alter view v_test as select 1 id from rdb$database;
drop view v_test;
commit;

Run it: $ /opt/fb30ss/bin/isql -q -i ./create-alter-drop-view-when-autoddl-off.sql

Output:

Statement failed, SQLSTATE = 08006
Error reading data from the connection.
After line 9 in file ./create-alter-drop-view-when-autoddl-off.sql
Statement failed, SQLSTATE = 08006
Error writing data to the connection.
After line 10 in file ./create-alter-drop-view-when-autoddl-off.sql

PS. LI-V3.0.0.32328, SuperServer; no such crash on FB 2.5; stacktrace see in attached zip.

Commits: 05dc362 FirebirdSQL/fbt-repository@d409126

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 6, 2016

Modified by: @pavel-zotov

Attachment: gdb-crash-when-create_alter_drop_view-within-single-tx.zip [ 12900 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 6, 2016

Commented by: @pavel-zotov

It's interesting that if some other object does exist in DB and it depends on view V_TEST (which is to be deleted) then, of course, view V_TEST can not be dropped, no crash occurs, but message about the reason why drop denied looks strange: "table V_TEST is not defined".

Example (we add two objects that depends on V_TEST: another view (v_test2) and procedure, then we attempt to drop V_TEST):

===
set autoddl off;
commit;
recreate table test(id int);
create view v_test as select * from test;

create view v_test2 as select * from v_test;

set term ^;
create procedure sp_test as
declare c1 cursor for(select id from v_test);
--declare c1 cursor for(select 1 as id from rdb$database);
begin
open c1;
while (1=1) do
begin
fetch c1;
end
close c1;
end
^
set term ;^

alter view v_test as select 1 id from rdb$database;

set count on;
set list on;

-- Let us check that object V_TEST:
-- 1) does exist
-- 2) is of type VIEW
-- 3) has source that we just assigned: "select 1 id from rdb$database"

select * from rdb$relations where rdb$relation_name=upper('v_test');

RDB$VIEW_BLR 6:1ed
BLOB display set to subtype 1. This BLOB: subtype = 2
RDB$VIEW_SOURCE 6:1ee
select 1 id from rdb$database
RDB$DESCRIPTION <null>
RDB$RELATION_ID <null>
RDB$SYSTEM_FLAG 0
RDB$DBKEY_LENGTH <null>
RDB$FORMAT <null>
RDB$FIELD_ID <null>
RDB$RELATION_NAME V_TEST
RDB$SECURITY_CLASS SQL$3
RDB$EXTERNAL_FILE <null>
RDB$RUNTIME <null>
RDB$EXTERNAL_DESCRIPTION <null>
RDB$OWNER_NAME SYSDBA
RDB$DEFAULT_CLASS <null>
RDB$FLAGS 1
RDB$RELATION_TYPE 1

Records affected: 1

--drop view v_test2;
--drop procedure sp_test;

drop view v_test;
commit;
Statement failed, SQLSTATE = 42S02
table V_TEST is not defined <<<<<<<<<<<<<<<< ??? 8-O ??? <<<<<<<<<<<
After line 34 in file qq.sql
Statement failed, SQLSTATE = 42S02
table V_TEST is not defined
After line 35 in file qq.sql

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 6, 2016

Modified by: @dyemanov

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 10, 2016

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 3.0 RC2 [ 10048 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 10, 2016

Modified by: @pavel-zotov

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

QA Status: No test => Done successfully

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 10, 2016

Modified by: @pavel-zotov

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

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

No branches or pull requests

2 participants