From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Klaus Kaisersberger <woodconsult(at)outlook(dot)de> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alexey M Boltenkov <padrebolt(at)yandex(dot)ru>, "Voillequin, Jean-Marc" <Jean-Marc(dot)Voillequin(at)moodys(dot)com>, "pgsql-sql(at)lists(dot)postgresql(dot)org" <pgsql-sql(at)lists(dot)postgresql(dot)org> |
Subject: | Re: unique index with several columns |
Date: | 2022-03-04 19:06:04 |
Message-ID: | CAKFQuwZuLqsmaFKHVbKry6v4tYHReVp_z6bgvr23vJXU1_OnRw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
The convention on these lists is to inline or bottom post.
On Fri, Mar 4, 2022 at 11:57 AM Klaus Kaisersberger <woodconsult(at)outlook(dot)de>
wrote:
> This should solve the task:
>
> create unique index idx on t ((
> case
> when c1 is null and c2 is null then null
> when c1 is null and c2 is not null then '{c2}'
> when c1 is not null and c2 is null then '{c1}'
> else '{c1,c2}'
> end));
>
>
I'm not sure what your '{c1}' syntax means but I'll take it you are
suggesting to construct an array. This seems to fail quite easily if the
values of c1 and c2 overlap.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Klaus Kaisersberger | 2022-03-04 19:18:07 | RE: unique index with several columns |
Previous Message | Klaus Kaisersberger | 2022-03-04 18:57:24 | RE: unique index with several columns |