Subject Re: [firebird-support] Default Domains
Author Thomas Steinmaurer
> I appreciate that this has been asked and answered over on Stack Overflow and possibly here as well (but I couldn't find it), but my query is slightly different.
> What do people consider to be 'best practice' with regard to domains?
> Should I create a domain for each datatype I use or just let Firebird create defaults for me?
> Why does Firebird create a different default domain for each column even with the same data types? For example if I have two columns, both INTs, both allow NULL, both no default value, I would still end up with two default domains. Should I create a domain called INT_NULL_NODEFAULT and use that wherever I need an INT column?

I use user-defined domains whenever I can, because it makes your field
data types more readable and your database won't get bloated with
system-defined (RDB$...) domain names.

I have both, domains with just the based simple datatype in its name, e.g.:


which are NOT NULL in naming convention or their nullable counterparts:


using NULL as domain name prefix.

The second approach is to put semantic into the domain name, e.g.:


etc ... Or have special domains for primary/foreign key columns, e.g.:


Hope this helps.

With regards,

Thomas Steinmaurer
Upscene Productions

Download LogManager Series, FB TraceManager today!
Continuous Database Monitoring Solutions supporting
Firebird, InterBase, Advantage Database, MS SQL Server
and NexusDB!