public inbox for [email protected]  
help / color / mirror / Atom feed
From: Paul A Jungwirth <[email protected]>
To: jian he <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: domain for WITHOUT OVERLAPS
Date: Tue, 23 Dec 2025 10:08:19 -0800
Message-ID: <CA+renyWqUsYPcEcY6mHjh8WcmSBR_F7=VxUxwSZsY1dGHW==Mw@mail.gmail.com> (raw)
In-Reply-To: <CA+renyW+ia6Uewa5+9f+cgTinndj8wt7yiG=3yZ_FG-hmiHn3w@mail.gmail.com>
References: <CACJufxGoAmN_0iJ=hjTG0vGpOSOyy-vYyfE+-q0AWxrq2_p5XQ@mail.gmail.com>
	<CA+renyU=ukksgiMQioaUixG+DJY1w1cwGdssKy9_hj_uaYDkBA@mail.gmail.com>
	<CACJufxEABtUZf=M9h3XpvjiWKFNDxObPpe6Ly9_dd-k3_xJJ+w@mail.gmail.com>
	<CA+renyW+ia6Uewa5+9f+cgTinndj8wt7yiG=3yZ_FG-hmiHn3w@mail.gmail.com>

On Mon, Dec 22, 2025 at 7:25 PM Paul A Jungwirth
<[email protected]> wrote:
>
> On Wed, Dec 10, 2025 at 8:23 PM jian he <[email protected]> wrote:
> > +-- tests for range over domain, multirange over a domain, custom range type over
> > +-- domain.
> > +--
> > +CREATE DOMAIN int4_d as integer check (value <> 10);
> > +CREATE TYPE int4_d_range as range (subtype = int4_d);
> > +CREATE DOMAIN int4multirange_d as int4multirange check (value <> '{[10,11)}');
> > +CREATE DOMAIN d_int4range1 AS int4range CHECK (VALUE <> '[10,11)');
> > +CREATE DOMAIN d_textrange2 AS textrange2 CHECK (VALUE <> '[c,d)');
> > +CREATE DOMAIN d_textrange2c AS d_textrange2;
> > +CREATE DOMAIN textmultirange2_d AS textmultirange2 CHECK (VALUE <> '{[c,d)}');
>
> The comment doesn't seem to match. It mentions three scenarios, but I'm seeing:
>
> - int4_d_range is a range over a domain.
> - int4multirange_d is a domain over a multirange.
> - d_int4range1 is a domain over a range.
> - d_textrange2 is a domain over a custom range.
> - d_textrange2c is a domain over a domain, with no extra constraint.
> What is this one for?
> - textmultirange2_d is a domain over a custom multirange.

Another variation I'm not seeing tested yet is a multirange over a
domain. In other words what ranges call the "subtype" is a domain.
Such a multirange is already created by these lines:

> > +CREATE DOMAIN int4_d as integer check (value <> 10);
> > +CREATE TYPE int4_d_range as range (subtype = int4_d);

For example we can use it:

[v19devel:5432][454113] postgres=# select '{[1,2)}'::int4_d_multirange;
 int4_d_multirange
-------------------
 {[1,2)}
(1 row)

[v19devel:5432][454113] postgres=# select '{[10,12)}'::int4_d_multirange;
ERROR:  value for domain int4_d violates check constraint "int4_d_check"
LINE 1: select '{[10,12)}'::int4_d_multirange;
               ^

So it seems worthwhile to test WITHOUT OVERLAPS with that variation as well.

Yours,

-- 
Paul              ~{:-)
[email protected]





view thread (11+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: domain for WITHOUT OVERLAPS
  In-Reply-To: <CA+renyWqUsYPcEcY6mHjh8WcmSBR_F7=VxUxwSZsY1dGHW==Mw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox