ODS upgrade deleting trigger

23 views
Skip to first unread message

Dimitry Sibiryakov

unread,
Apr 8, 2024, 12:07:57 PMApr 8
to firebir...@googlegroups.com
Hello All,

In INI_upgrade() I'm trying to delete a system trigger that I don't want to
be in the new ODS and get error:

> ODS upgrade failed while adding new system triggers
> -action cancelled by trigger (0) to preserve data integrity
> -cannot modify or erase a system trigger

I can do something with misleading message "while adding new system triggers"
but how to solve actual error?

Attempted code:

FOR(REQUEST_HANDLE handle TRANSACTION_HANDLE transaction)
TRG IN RDB$TRIGGERS
WITH TRG.RDB$SYSTEM_FLAG EQ 1
{
fb_utils::exact_name(TRG.RDB$TRIGGER_NAME);
bool found = false;
for (const jrd_trg* trigger = triggers; trigger->trg_name; ++trigger)
{
if (strcmp(TRG.RDB$TRIGGER_NAME, trigger->trg_name) == 0)
{
found = true;
break;
}
}
if (!found)
{
ERASE TRG;
}
}
END_FOR


--
WBR, SD.

Dimitry Sibiryakov

unread,
Apr 9, 2024, 11:20:00 AMApr 9
to firebir...@googlegroups.com
Dimitry Sibiryakov wrote 08.04.2024 18:07:
>   I can do something with misleading message "while adding new system triggers"
> but how to solve actual error?

I've found that following code does the trick but I'm not sure that it is
correct enough: ODS upgrade is done in an exclusive connection but I'm not sure
about side effects of DB linger for example.

jrd_rel* relTriggers = MET_lookup_relation_id(tdbb, rel_triggers, false);
relTriggers->rel_pre_erase->clear();

--
WBR, SD.

Dimitry Sibiryakov

unread,
Apr 9, 2024, 2:12:45 PMApr 9
to firebir...@googlegroups.com
Dimitry Sibiryakov wrote 08.04.2024 18:07:
>   In INI_upgrade() I'm trying to delete a system trigger that I don't want to
> be in the new ODS

BTW, I've found that between 13.0 and 13.2 much more system triggers were
deleted without adding this into upgrade routine.
Doesn't it mean that a database with ODS 13.2 upgraded from 13.0 will be
different from a database created as 13.2 originally and some Firebird
functionality can be not working?

--
WBR, SD.

Reply all
Reply to author
Forward
0 new messages