Re: WIP: RangeTypes

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP: RangeTypes
Date: 2011-02-02 17:55:34
Message-ID: 1296669334.11513.843.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 2011-01-30 at 17:14 -0500, Tom Lane wrote:
> Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> > On Sun, 2011-01-30 at 02:55 +0000, Thom Brown wrote:
> >> postgres=# select '[18,20]'::numrange @> 19;
> >> ERROR: operator does not exist: numrange @> integer
> >> LINE 1: select '[18,20]'::numrange @> 19;
> >> ^
> >> HINT: No operator matches the given name and argument type(s). You
> >> might need to add explicit type casts.
>
> > It's because it doesn't know the type on the right side, and assumes
> > it's an int4.
>
> Well, yeah, it is an int4. The question ought to be phrased "why does
> the parser fail to promote the int4 to numeric?". There might be some
> excuse for an "operator is not unique" here, but I don't understand the
> above failure --- it should be able to use an implicit coercion from
> int4 to numeric.

The problem exists for arrays, as well, so I think this is just a
limitation of the type system.

Regards,
Jeff Davis

postgres=# select ARRAY[1.4,1.5,1.6]::numeric[] || 5.0;
?column?
-------------------
{1.4,1.5,1.6,5.0}
(1 row)

postgres=# select ARRAY[1.4,1.5,1.6]::numeric[] || 5;
ERROR: operator does not exist: numeric[] || integer
LINE 1: select ARRAY[1.4,1.5,1.6]::numeric[] || 5;
^
HINT: No operator matches the given name and argument type(s). You
might need to add explicit type casts.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2011-02-02 17:58:39 Re: SSI patch version 14
Previous Message Heikki Linnakangas 2011-02-02 17:41:35 Re: SSI patch version 14