Re: PostgreSQL does CAST implicitely between int and a domain derived from int

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jean-Michel Pouré <jm(at)poure(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: PostgreSQL does CAST implicitely between int and a domain derived from int
Date: 2009-08-29 17:44:08
Message-ID: 28629.1251567848@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Jean-Michel =?ISO-8859-1?Q?Pour=E9?= <jm(at)poure(dot)com> writes:
> In Drupal database, we have two types:
> CREATE DOMAIN int_unsigned
> AS integer
> CONSTRAINT int_unsigned_check CHECK ((VALUE >= 0));

> Why do queries cast between integer and int_unsigned?

That domain doesn't have any operators of its own. To compare to
another value, or use an index, you have to cast it to integer which
does have operators. It's a no-op cast, but logically necessary.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message David Rees 2009-08-29 19:52:07 Re: What exactly is postgres doing during INSERT/UPDATE ?
Previous Message Jean-Michel Pouré 2009-08-29 17:38:41 Re: PostgreSQL does CAST implicitely between int and a domain derived from int