Skip site navigation (1) Skip section navigation (2)

Re: WIP: RangeTypes

From: Thom Brown <thom(at)linux(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP: RangeTypes
Date: 2011-01-30 22:07:08
Message-ID: AANLkTi=JaHDNLh2RGudXWE9pAmdn9-RS2FQ5N4ooWnt9@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On 30 January 2011 21:33, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> [ trying a third time to send this message, apparently there were
> infrastructure problems before ]
>
> 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.
>
>    select '[18,20]'::numrange @> 19.0;
>
> works.

My misapprehension stems from the assumption that the
anyrange,anynonarray entry for the @> operator, and the
contains(anyrange, anynonarray) function would resolve since numrange
is a subset of anyrange and int4 is a subset of anynonarray.
Obviously it shouldn't work as the underlying type of the range isn't
an integer, but just trying to understand how the error message came
about.

-- 
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

In response to

pgsql-hackers by date

Next:From: Robert HaasDate: 2011-01-30 22:08:12
Subject: Re: autogenerating error code lists (was Re: [COMMITTERS] pgsql: Add foreign data wrapper error code values for SQL/MED.)
Previous:From: Jan UrbańskiDate: 2011-01-30 22:04:27
Subject: Re: wildcard search support for pg_trgm

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group