8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 22:43:03 +01:00

Ensure system tables have proper format. The DFW handler is usually skipped for system tables, unless dfw_update_format is posted explicitly.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dmitry Yemanov 2023-07-21 20:22:37 +03:00
parent ae7bee2664
commit aa164fb32c

View File

@ -1966,6 +1966,21 @@ static void store_relation(thread_db* tdbb,
MetaName securityClass, defaultClass; MetaName securityClass, defaultClass;
security.storeSecurityClass(tdbb, securityClass, defaultClass); security.storeSecurityClass(tdbb, securityClass, defaultClass);
// Find the format matching the number of stored fields
// and pass it to RDB$RELATIONS
USHORT formatNumber = 0;
const auto relation = MET_relation(tdbb, relId);
fb_assert(relation && relation->rel_formats);
for (const auto format : *relation->rel_formats)
{
if (format->fmt_count == fieldId)
{
formatNumber = format->fmt_version;
break;
}
}
STORE(REQUEST_HANDLE handle TRANSACTION_HANDLE transaction) STORE(REQUEST_HANDLE handle TRANSACTION_HANDLE transaction)
X IN RDB$RELATIONS X IN RDB$RELATIONS
{ {
@ -1985,7 +2000,7 @@ static void store_relation(thread_db* tdbb,
X.RDB$DEFAULT_CLASS.NULL = FALSE; X.RDB$DEFAULT_CLASS.NULL = FALSE;
X.RDB$FIELD_ID = fieldId; X.RDB$FIELD_ID = fieldId;
X.RDB$FORMAT = 0; X.RDB$FORMAT = formatNumber;
X.RDB$SYSTEM_FLAG = RDB_system; X.RDB$SYSTEM_FLAG = RDB_system;
X.RDB$DBKEY_LENGTH = 8; X.RDB$DBKEY_LENGTH = 8;
} }