Re: unnesting multirange data types

From: "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: unnesting multirange data types
Date: 2021-06-13 12:29:38
Message-ID: 793a75cc-7d03-24ce-8f39-2f56555a0764@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 6/13/21 8:26 AM, Jonathan S. Katz wrote:

> One question: if I were to make a custom multirange type (e.g. let's say
> I use "inet" to make "inetrange" and then a "inetmultirange") will this
> method still work? It seems so, but I wanted clarify.

I went ahead and answered this myself: "yes":

CREATE TYPE inetrange AS RANGE (SUBTYPE = inet);

SELECT unnest(inetmultirange(inetrange('192.168.1.1', '192.168.1.5'),
inetrange('192.168.1.7', '192.168.1.10')));
unnest
----------------------------
[192.168.1.1,192.168.1.5)
[192.168.1.7,192.168.1.10)
(2 rows)

Awesome stuff.

Jonathan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2021-06-13 12:43:43 Re: Signed vs Unsigned (take 2) (src/backend/storage/ipc/procarray.c)
Previous Message Jonathan S. Katz 2021-06-13 12:26:19 Re: unnesting multirange data types