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
Gbak cannot restore database with cyclic dependencies between views [CORE4812] #5110
Comments
Commented by: Sean Leyne (seanleyne) I wonder if the definition of circular views should be prevented? {that's one way of solving this problem ;-]} |
Commented by: @cincuranet As the i.e. FKs can have cyclic deps I believe this is valid scenario. |
Commented by: Sean Leyne (seanleyne) Understood but, FKs can't contain invalid references, and the restore of the FKs is agnostic to the circular'ness of the relationship. The constraint are restored after the data has been restored and the index building doesn't re-check the constraint (it is checked when the FK is initially defined, so the data/values is guaranteed to be correct). Further, with the introduction of recursive CTE's, the need for circular Views has been practically eliminated. |
Commented by: @asfernandes Cyclic views should be disallowed. Views should be "expanded" in compile time, so that does not work. |
Commented by: @cincuranet @sean You can have cycles in computed fields (yes it's ugly). ;) That's more like the views. |
Commented by: @pavel-zotov When we do: -- then ISQL -X shows almost the same: first it displays procedures with empty bodies and after it fills them. What if restore first will create all view like this: create view v_a as create view v_b as -- and after all such 'dummy' views with necessary columns are created, continue with: alter view v_a as <stored "real" select for v_a>; - ? |
Commented by: @cincuranet That's what I'm doing in a code I'm writing right now. |
Commented by: @asfernandes > @sean You can have cycles in computed fields (yes it's ugly). ;) That's more like the views. Jiri, it just crashs. Conceptually, this type of cyclic does not and cannot work. |
Submitted by: @cincuranet
Steps to reproduce:
*** 1:
CREATE OR ALTER VIEW CYCLE_A(
COL)
AS
select RDB$RELATION_ID from rdb$database
;
*** 2:
CREATE OR ALTER VIEW CYCLE_B(
COL)
AS
select RDB$RELATION_ID from rdb$database
;
*** 3:
CREATE OR ALTER VIEW CYCLE_A(
COL)
AS
select RDB$RELATION_ID from rdb$database
union all
select col from cycle_b
;
*** 4:
CREATE OR ALTER VIEW CYCLE_B(
COL)
AS
select RDB$RELATION_ID from rdb$database
union all
select col from cycle_a
;
*** 5: Backup database using gbak.
*** 6: Try restoring database using gbak. Fails with depth limit failure.
The text was updated successfully, but these errors were encountered: