From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Exclude constraint on ranges : commutative containment : allow only complete containment |
Date: | 2020-01-29 18:32:09 |
Message-ID: | a1596542-a70f-818e-7f65-280837da31f5@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 1/29/20 8:12 AM, Achilleas Mantzios wrote:
> Hello Dear Postgresql ppl,
> I have a table with date ranges and need to express the following
> constraint : allow overlaps only if there is complete containment, e.g.
> allow values in rows like :
> [2020-01-01,2020-01-31)
> [2020-01-02,2020-01-10)
> [2020-01-10,2020-01-20)
>
> but disallow rows like
>
> [2020-01-02,2020-01-10)
> [2020-01-08,2020-01-11)
I'm missing something. Can you provide a more complete example?
>
> I think that writing a new commutative range operator e.g. |<@@> which
> would return true if the left operand is either contained by or contains
> the right operand and false otherwise would solve this, I am just
> wondering if there is a more elegant and economical way to express this.
> (besides writing a trigger which is always an option).|
>
> --
> Achilleas Mantzios
> IT DEV Lead
> IT DEPT
> Dynacom Tankers Mgmt
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Lewis | 2020-01-29 18:43:29 | Re: Exclude constraint on ranges : commutative containment : allow only complete containment |
Previous Message | Tom Lane | 2020-01-29 18:22:31 | Re: Performance Issue after upgrade from 9 to 11 |