Re: anyelement -> anyrange

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Jeff Davis <pgsql(at)j-davis(dot)com>
Subject: Re: anyelement -> anyrange
Date: 2016-08-18 18:06:35
Message-ID: CADkLM=fjGje7+UkHEkf2OXPWYnhh04H+LzxzzUDi2B5SAyi9Vw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 16, 2016 at 9:29 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com> writes:
> > I can't think of any reason you'd want two different range types on a
> > single element type.
>
> We would not have built it that way if there were not clear use-cases.
> An easy example is you might want both a continuous timestamp range
> and one that is quantized to hour boundaries. Primarily what the
> range type brings in besides the element type is a canonicalization
> function; and we can't guess which one you want.
>
> regards, tom lane
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

Jim,

I wrote a routine that fishes in the dictionary for a suitable range type:
https://github.com/moat/range_partitioning/blob/master/sql/range_partitioning.sql#L459-L485

Obviously, it has the problems when the number of suitable ranges <> 1 as
mentioned by Tom.

You might also find some gleanable gems in:
https://github.com/moat/range_type_functions/blob/master/doc/range_type_functions.md

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-08-18 18:06:39 Re: Making pg_hba.conf case-insensitive
Previous Message Heikki Linnakangas 2016-08-18 18:02:25 Re: PROPOSAL: make PostgreSQL sanitizers-friendly (and prevent information disclosure)