Re: PostgreSQL does CAST implicitely between int and a domain derived from int - Mailing list pgsql-performance

From Tom Lane
Subject Re: PostgreSQL does CAST implicitely between int and a domain derived from int
Date
Msg-id 28629.1251567848@sss.pgh.pa.us
Whole thread Raw
In response to Re: PostgreSQL does CAST implicitely between int and a domain derived from int  (Jean-Michel Pouré <jm@poure.com>)
Responses Re: PostgreSQL does CAST implicitely between int and a domain derived from int
List pgsql-performance
Jean-Michel =?ISO-8859-1?Q?Pour=E9?= <jm@poure.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

pgsql-performance by date:

Previous
From: Jean-Michel Pouré
Date:
Subject: Re: PostgreSQL does CAST implicitely between int and a domain derived from int
Next
From: David Rees
Date:
Subject: Re: What exactly is postgres doing during INSERT/UPDATE ?