Is there a quick way to list all Firebird domains defined for a database that are actually not used by any field ? I have a large database with many tables and many domains and it seems that a lot of them are not anymore used, so I guess it's time for a cleanup !
I think this is possible by querying the RDB$...
system tables, but I'm unsure how to do this.
SELECT
f.rdb$field_name
FROM
rdb$fields f
LEFT JOIN rdb$relation_fields rf
ON rf.rdb$field_source = f.rdb$field_name
WHERE
rf.rdb$field_name IS NULL
AND
COALESCE(f.rdb$system_flag, 0) = 0
来源:https://stackoverflow.com/questions/35432357/list-all-unused-domains-for-a-firebird-database