On 29/08/2024 05:20, Alex Peshkoff wrote:
> On 8/29/24 03:44, Adriano dos Santos Fernandes wrote:
>> On 22/08/2024 07:52, Alex Peshkoff wrote:
>>> On 8/22/24 13:36, Adriano dos Santos Fernandes wrote:
>>>> Hi!
>>>>
>>>> It's possible to restore databases with a giving gbak for Firebird
>>>> version X using Firebird versions < X with any older ODS.
>>>>
>>>> This requires many variations of queries due to fields not present
>>>> before, and I doubt everything even works correctly, as it's not being
>>>> really tested.
>>>>
>>>> I propose to get rid of this and officially support downgrade only for
>>>> the direct previous major ODS.
>>> Moreover - we always recommend the following way of ODS downgrade:
>>> 1. Create backup of DB to be downgraded using gbak of target FB version
>>> (to which DB to be downgraded). To make it work reliable DB should be
>>> opened by FB server of native for it version (from which downgrade is
>>> done). Gbak attaches to it remotely (certainly, use of localhost: is
>>> OK).
>>> 2. Next resulting .gbak file is restored in usual way.
>>>
>> Seems ok for me, except that it makes impossible to cleanup/refactor
>> system objects, unless older gbak is also changed.
>
For example, remove an unused for long time field.
But I found possible problems with downgrade using older gbak with schemas.
For example, if there is more than one schema (without repeated object
names), I support that downgrade should be possible. But if user objects
are separated from system objects, there will be permissions for user's
schemas and older gbak will read and write permissions for objects that
the older engine does not understand.
I'm not saying that new gbak will always work for downgrade, but tries
for this case:
---
if (tdgbl->runtimeODS <= DB_VERSION_DDL8)
{
// Discard roles for IB4.
if (user_type == obj_sql_role || object_type == obj_sql_role)
exists = false;
}
---
There is also this weird thing:
---
if ( (tdgbl->RESTORE_format < 11) && (object_type > 19) ) // FB 4 has a
shift :(
object_type++;
---
Adriano