To get the table schema change history, I ran a query:
select CAST(SUBSTRING(f.rdb$descriptor FROM 1 FOR 32000) AS VARCHAR(32000)) log
from rdb$formats f
join rdb$relations r on r.rdb$relation_id = f.rdb$relation_id
where r.rdb$relation_name = 'MY_TABLE_NAME'
Documentation states the following:
RDB $ DESCRIPTOR | BLOCK FORMAT | Saves column names and data attributes as BLOBs since they were at the time the format record was created
The following is the result of the query:
LOG TABLE FORMAT ID
------------------------------------------------- ----------------
4: type=9 (LONG) length=4 sub_type=0 flags=0x0 15
8: type=9 (LONG) length=4 sub_type=0 flags=0x0
12: type=14 (DATE) length=4 sub_type=0 flags=0x0
16: type=9 (LONG) length=4 sub_type=0 flags=0x0
20: type=9 (LONG) length=4 sub_type=0 flags=0x0
24 <-- probably truncated?
------------------------------------------------- ----------------
4: type=9 (LONG) length=4 sub_type=0 flags=0x0 16
8: type=3 (VARCHAR) length=12 sub_type=52 flags=0x0
20: type=14 (DATE) length=4 sub_type=0 flags=0x0
24: type=9 (LONG) length=4 sub_type=0 flags=0x0
28: type=9 (LONG) length=4 sub_type=0 flags=0x0
There are 28 event lines in total for the table. But I can not understand the meaning of the numbers 4, 8, 12, 16, 20, 24, 28. Well, let's issue the following query:
SELECT
RF.RDB$FIELD_POSITION,
RF.RDB$FIELD_ID,
F.RDB$FIELD_TYPE,
F.RDB$FIELD_SUB_TYPE
FROM RDB$RELATION_FIELDS RF
JOIN RDB$FIELDS F ON (F.RDB$FIELD_NAME = RF.RDB$FIELD_SOURCE)
WHERE RF.RDB$RELATION_NAME = 'MY_TABLE_NAME'
ORDER BY RF.RDB$FIELD_POSITION;
And here are the results:
As you can see, I have only 22 columns, neither the position nor id can match the 24/28 keys from the log above.
Another conclusion: there type=3 (VARCHAR)
s is sub_type=52
in the log, while 37 is the VARCHAR code.
? ?