[IMP] expression.py: add a check to forbid records in domains

Records in domains cause a "maximum recursion depth exceeded" error when
converted to SQL. Simply add a test to show a better error message.

Fixes #3022.