Subject Restore works with 1.0.3 and fails with 1.5.2
Author Milan Babuskov
Hello,

I'm having a strange problem. I decided to switch one of production sites from
Firebird 1.0 to Firebird 1.5. I have two separate servers. I backed up the
database at one, and try to restore it on the other, but it fails.

The same backup file restores with FB 1.0.3 without problems.
The problematic version is FB ClassicServer 1.5.2-4371.

Here's the tail of restore:
gbak: restoring privilege for user SYSDBA
gbak: creating indexes
gbak: restoring index RDB$PRIMARY24
gbak: restoring index RDB$PRIMARY21
gbak: restoring index RDB$PRIMARY17
gbak: cannot commit index RDB$PRIMARY16
gbak: ERROR: I/O error for file ""
gbak: ERROR: Error while trying to open file
gbak: ERROR: Permission denied
gbak: ERROR: sort error
gbak: ERROR: action cancelled by trigger (3) to preserve data integrity
gbak: ERROR: Cannot deactivate primary index
gbak: Exiting before completion due to errors

I checked the RDB$PRIMARY16 index. It is a primary key that composes of two
columns varchar(20) + integer. I did a select that show that there aren't
duplicates:

SQL> show table fiscal_roba;
PRINTER_NAME VARCHAR(20) Not Null
FISCAL_ID INTEGER Not Null
VREME TIMESTAMP Nullable
CONSTRAINT INTEG_78:
Primary key (PRINTER_NAME, FISCAL_ID)
SQL> select printer_name, fiscal_id, count(*)
CON> from fiscal_roba
CON> group by printer_name, fiscal_id
CON> having count(*) > 1;
SQL> commit;

Here's some info about the index (query from 1.0.3):

SQL> select * from rdb$indices where rdb$index_name = 'RDB$PRIMARY16';

RDB$INDEX_NAME RDB$RELATION_NAME RDB$INDEX_ID
RDB$UNIQUE_FLAG RDB$DESCRIPTION RDB$SEGMENT_COUNT RDB$INDEX_INACTIVE
RDB$INDEX_TYPE RDB$FOREIGN_KEY RDB$SYSTEM_FLAG
RDB$EXPRESSION_BLR RDB$EXPRESSION_SOURCE RDB$STATISTICS
=============================== =============================== ============
=============== ================= ================= ==================
============== =============================== ===============
================== ===================== =======================

RDB$PRIMARY16 FISCAL_ROBA 1
1 <null> 2 0
0 <null> <null> <null>
<null> 0.000000000000000


Any ideas what to do next? The backup file is really big, and contains sensitive
data, so I can't give it for analisys.

--
Milan Babuskov
http://fbexport.sourceforge.net
http://www.flamerobin.org