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

GBAK restore failed when there is SQL function accessing table and switch -O(NE_AT_A_TIME) is used [CORE5143] #5426

Closed
firebird-issue-importer opened this issue Mar 9, 2016 · 7 comments

Comments

@firebird-issue-importer
Copy link

firebird-issue-importer commented Mar 9, 2016

Submitted by: @hvlad

Is related to CORE949

Commits: 76bd7cd 4711a3b

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 9, 2016

Commented by: @hvlad

1. Prepare database

create database core-5143.fdb;

create table t1 (id int);
create table t2 (id int);

set term ^;
create function f1 returns int
as
begin
return (select count(*) from t1) + (select count(*) from t2);
end^
set term ;^

2. Make backup
gbak -b core-5143.fdb core-5143.fbk

3. Restore using switch -one_at_a_time
gbak -rep -v -one core-5143.fbk core-5143.1.fdb
gbak:opened file core-5143.fbk
...
gbak:restoring function F1
gbak: restoring argument for function F1
gbak:restoring table T1
gbak: restoring column ID
gbak:committing metadata for table T1
gbak:error committing metadata for table T1
gbak: ERROR:table T2 is not defined

!!!

gbak:restoring table T2
gbak: restoring column ID
gbak:committing metadata for table T2
gbak:error committing metadata for table T2
gbak: ERROR:unsuccessful metadata update
gbak: ERROR: TABLE T2
gbak: ERROR: Can't have relation with only computed fields or constraints
gbak:committing metadata
gbak: restoring privilege for user SYSDBA
gbak: ERROR:action cancelled by trigger (0) to preserve data integrity
gbak: ERROR: could not find object for GRANT
gbak:Exiting before completion due to errors

4. Restore NOT using switch -one_at_a_time
gbak -rep -v core-5143.fbk core-5143.1.fdb
gbak:opened file core-5143.fbk
...
gbak:restoring function F1
gbak: restoring argument for function F1
gbak:restoring table T1
gbak: restoring column ID
gbak:restoring table T2
gbak: restoring column ID
gbak:committing metadata
gbak: restoring privilege for user SYSDBA
...
gbak:creating indexes
gbak:committing metadata
gbak:fixing views dbkey length
gbak:updating ownership of packages, procedures and tables
gbak:adding missing privileges
gbak:fixing system generators
gbak:finishing, closing, and going home
gbak:adjusting the ONLINE and FORCED WRITES flags

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 27, 2016

Modified by: @dyemanov

Link: This issue is related to CORE949 [ CORE949 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 27, 2016

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 27, 2016

Commented by: @dyemanov

I see that packages are affected the same way. Solution looks simple - just revert bugfix CORE949 because it's superseded by bugfix CORE374, which works equally well for procedures, functions and packages.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 27, 2016

Modified by: @dyemanov

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

resolution: Fixed [ 1 ]

Fix Version: 3.0.0 [ 10740 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 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 Apr 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