Re: Query not using index for user defined type

From: Rodrigo Barboza <rodrigombufrj(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Query not using index for user defined type
Date: 2013-04-15 22:59:01
Message-ID: CANs8QJZnyjnKwvnRKXQuA51ESO50r2G6xnk8mZ2aba1_9ewyiQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 15, 2013 at 7:51 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Rodrigo Barboza <rodrigombufrj(at)gmail(dot)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?

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2013-04-15 23:55:28 Re: Why are JSON extraction functions STABLE and not IMMUTABLE?
Previous Message Tom Lane 2013-04-15 22:51:38 Re: Query not using index for user defined type