Re: Weird behavior with custom operators

From: Matthieu HUIN <matthieu(dot)huin(at)wallix(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Weird behavior with custom operators
Date: 2010-08-26 15:23:14
Message-ID: 1282836194.2536.28.camel@mhu.ifr.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Tom,

Thanks for the answer. I think this is exactly what's happening here.
What I cannot understand though, is why this specific error isn't thrown
when using the others operators I defined that have the same kind of
operands.

About your last question; I created this datatype so that I could store
values as text and compare them to floats easily if they can be
converted into a numeric type (since numeric order differs from
alphanumeric order). I used to call CASTs in my queries when needed, but
I realized that doing so made my various existing indexes useless. And
since I'd rather not create a specific table for numeric values, this is
what I came up with.

I have very little experience with postgresql or databases in general so
any advice on that will be gladly taken.

You are suggesting to use a domain : would I be able to extend operators
that way ?

Le jeudi 26 août 2010 à 11:05 -0400, Tom Lane a écrit :
> Matthieu HUIN <matthieu(dot)huin(at)wallix(dot)com> writes:
> > xxx=> SELECT value FROM tags WHERE value > 3 LIMIT 1;
> > ERROR: unsupported type: 17886
>
> I think you're probably hitting this:
>
> /*
> * Can't get here unless someone tries to use scalarltsel/scalargtsel on
> * an operator with one numeric and one non-numeric operand.
> */
> elog(ERROR, "unsupported type: %u", typid);
>
> While you could possibly make it work by writing wrappers around those
> selectivity functions instead of using them directly, I'm kind of
> wondering what is the point of this datatype anyway? Seems like
> declaring it as a domain over text might be easier.
>
> regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael P. Soulier 2010-08-26 15:45:48 looping on NEW and OLD in a trigger
Previous Message Tom Lane 2010-08-26 15:05:06 Re: Weird behavior with custom operators