Subject RE: [firebird-support] Error loading DB using FB 2.1.3
Author Dunbar, Norman (Capgemini)
Afternoon,

>> I am trying to load an FB 1.5.5 database into FB 2.1.3. I
>> back it up using gbak on 1.5.5 and reload it using gbak on
>> 2.1.3. I am getting the following error when restoring the database:
>>
>> gbak:restoring data for table LOADS
>> gbak: ERROR:value exceeds the range for valid dates
>> gbak: ERROR:gds_$send failed
>>
>> The database restores just fine using gbak from FB 1.5.5.
>> That would seem to indicate that there is nothing wrong with
>> the data.
>>
>> What could be causing this error?

I suspect your error is possibly cuased by the old database being in
dialect 1 and the new one being in dialect 3. What is the output of the
following command for both databases please:

gstat -header <database_name>

Look for "ODS version" and "Database dialect".

If the ODS version is greter than 10 then a DATE is now a TIMESTAMP and
a DATE only holds a DATE, not a DATE and TIME.

From the "gfix" manual at www.firebirdsql.org:

* Dialect 1 stores date and time information in a DATE data type and has
a TIMESTAMP data type which is
identical to DATE. Double quotes are used to delimit string data. The
precision for NUMERIC and DECIMAL
data types is less than a dialect 3 database and if the precision is
greater than 9, Firebird stores these as DOUBLE
PRECISION. INT64 is not permitted as a data type.

* Dialect 2 is available only on the Firebird client connection and
cannot be set in the database. It is intended
to assist debugging of possible problems with legacy data when migrating
a database from dialect 1 to 3. This
dialect cannot be set for a database using gfix. (See below.)

* Dialect 3 databases allow numbers (DECIMAL and NUMERIC data types) to
be stored as INT64 when the
precision is greater than 9. The TIME data type is able to be used and
stores time data only. The DATE data
type stores on date information. Double quotes can be used but only for
identifiers that are case dependent, not
for string data which has to use single quotes.

You can use gfix to change the database dialect with:

gfix -sql_dialect 1 <database_name_or_alias>

Which *might* allow you to recover the version 1.5.5 backup file into
the new Firebird 2.1.3 database.


Good luck.


Cheers,
Norman.

Norman Dunbar
Contract Senior Oracle DBA
Capgemini Database Team (EA)
Internal : 7 28 2051
External : 0113 231 2051



Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else. We have checked this email and its attachments for viruses. But you should still check any attachment before opening it. We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes. If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk

Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else.

We have checked this email and its attachments for viruses. But you should still check any attachment before opening it.
We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes.

If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk