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

Altering procedure parameters can lead to unrestorable database [CORE1592] #2013

Closed
firebird-issue-importer opened this issue Nov 13, 2007 · 6 comments

Comments

@firebird-issue-importer

Submitted by: mbabuskov (mbabuskov)

Votes: 1

Tried with 1.5.4.4910 and 2.1.0.16780

The problem is that FB tracks stored procedure column dependencies,
but doesn't enforce them when ALTER PROCEDURE is run. You can easily
rename or delete parameters and thus create a database structure that
doesn't survive the backup/restore cycle. Here's a small test case:

Database: test.fdb, User: sysdba
SQL> set term !! ;
SQL> create procedure p1 returns ( x1 integer ) as begin
CON> x1 = 10; suspend;
CON> end !!
SQL> create procedure p2 returns ( x1 integer ) as begin
CON> for select x1 from p1 into :x1 do suspend;
CON> end!!
SQL> alter procedure p1 returns ( x2 integer ) as begin
CON> x2 = 10; suspend;
CON> end!!
SQL> exit!!

Now, backup that database, and when you try to restore it, you would get:

gbak:creating indexes
gbak: committing metadata
gbak: ERROR:invalid request BLR at offset 47
gbak: ERROR: column X1 is not defined in table X1

The error message is also wrong, as X1 is not a table, and procedure name is P1.

As I understand, the parameters are recreated at ALTER statement. To fix the problem, Firebird should not allow the ALTER PROCEDURE statements if there are records in RDB$DEPENDENCIES that reference a parameter that is not going to exists after the statement. This would allow to spot the problem at development time and not much later when user tries to restore the backup (can be too late at that point).

Commits: de7edf7

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 28, 2008

Modified by: @pcisar

Workflow: jira [ 13407 ] => Firebird [ 14147 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 16, 2010

Commented by: Norldir Kunkel (norldir)

Same problema as firebird 2.1 and 2.5.

How can i hexxedit backup file to restore database ? My FDB was losted and i have only backup from a firebird 2.1.3 server.

@firebird-issue-importer
Copy link
Author

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

Modified by: @dyemanov

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Aug 31, 2018

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 4.0 Beta 1 [ 10750 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 2, 2018

Modified by: @pavel-zotov

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

QA Status: Done successfully

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 2, 2018

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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants