Re: unnesting multirange data types - Mailing list pgsql-hackers

From Jonathan S. Katz
Subject Re: unnesting multirange data types
Date
Msg-id 793a75cc-7d03-24ce-8f39-2f56555a0764@postgresql.org
Whole thread Raw
In response to Re: unnesting multirange data types  ("Jonathan S. Katz" <jkatz@postgresql.org>)
List 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


Attachment

pgsql-hackers by date:

Previous
From: "Jonathan S. Katz"
Date:
Subject: Re: unnesting multirange data types
Next
From: Ranier Vilela
Date:
Subject: Re: Signed vs Unsigned (take 2) (src/backend/storage/ipc/procarray.c)