Re: Query not using index for user defined type - Mailing list pgsql-hackers

From Rodrigo Barboza
Subject Re: Query not using index for user defined type
Date
Msg-id CANs8QJZnyjnKwvnRKXQuA51ESO50r2G6xnk8mZ2aba1_9ewyiQ@mail.gmail.com
Whole thread Raw
In response to Re: Query not using index for user defined type  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers



On Mon, Apr 15, 2013 at 7:51 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Rodrigo Barboza <rodrigombufrj@gmail.com> writes:
> I created a implic cast for mytype to bigint.
> So when I do the same query it does seq scan, because the column is
> transformed into bigint.

Yeah.  One reason why there's not an unsigned int type already is that
it seems impossible to shoehorn it into the numeric promotion hierarchy
without breaking a lot of existing cases.  You definitely aren't likely
to get nice results by just adding some implicit casts without doing a
very careful design beforehand.

                        regards, tom lane

I just added implicit cast from my type to int8, numeric and float.
No implicit cast for lower level types.
Isn't it safe?
The problem would be only about the index?

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Query not using index for user defined type
Next
From: Bruce Momjian
Date:
Subject: Re: Why are JSON extraction functions STABLE and not IMMUTABLE?