GEOT-4916: improve checks on domain types
Merge pull request #563 from dromagnoli/GEOT-4916-12.x

GEOT-4916: improve checks on domain types: backport to 12.x