Thread: Domains as typedefs: Performance and automatic casting

Domains as typedefs: Performance and automatic casting

From
hernan gonzalez
Date:
I plan to define two domains with no contraints, sort of typedefs, to
work with date-times inside my application:

 CREATE DOMAIN instant AS timestamp(3) with time zone;
 CREATE DOMAIN localdatetime AS timestamp(3) without time zone;

Two questions:

1. I guess that there is no performance penalty in using such a DOMAIN
Am I right?

2. I see that PG does automatic (implicit casting)  between  TIMESTAMP
WITH/WITHOUT TIME ZONE types,
it accept one type in place of the other (a dangerous thing, IMO, as
the conversion is sensitive to the current
timezone) ; the same happens for these DOMAINs .
I guess that I must live with this, now way to disallow it... Am I right?

Hernán J. González