Domains as typedefs: Performance and automatic casting

From: hernan gonzalez <hgonzalez(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Domains as typedefs: Performance and automatic casting
Date: 2011-06-16 18:33:12
Message-ID: BANLkTik50wPxK7MsCkPqYo_LqsAwKHxmZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Browse pgsql-general by date

  From Date Subject
Next Message Mike Christensen 2011-06-16 18:47:18 Re: Constraint to ensure value does NOT exist in another table?
Previous Message Greg Smith 2011-06-16 18:31:03 Re: Postgres performance and the Linux scheduler