I have a procedure that depends on a view in my Firebird database. Today, I changed the view, and by doing so, I expected to resolve a bug in my procedure. Then I found out (after about an hour of frustration), that my procedure was still using a previous version of my view.
Here's an example of what I'm talking about (granted, it's not a very real-world usage of a procedure):
-- Create a view
create view select_one_view as select 1 as one from rdb$database;
-- Create a procedure that selects from my view
SET TERM ^ ;
create procedure select_from_view
returns (number integer) as
begin
select one from select_one_view into :number;
suspend;
end^
SET TERM ; ^
So now I've got my procedure that depends on a view. When I execute this procedure (execute procedure select_from_view
), it returns 1, as expected.
Now let's alter the view:
alter view select_one_view as select 2 as one from rdb$database;
At this point, I would expect my procedure to return 2. Instead, it returns 1.
As a sanity check, I tried doing the same thing in SQL Server, but it worked as I expected, returning 2 after I altered my view.
Why in the world would I want this to happen? Am I expected to manually alter every procedure/trigger that depends on my view? It seems as if this behavior would only serve to create unnoticed problems.
P.S. I've tried this with versions V2.5.2.26539 and V2.5.2.26540.