Re: BUG #19098: Can't create unique gist index, where pg_indexes says that WITHOUT OVERLAPS does exacly that

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: n(dot)bartek3762(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19098: Can't create unique gist index, where pg_indexes says that WITHOUT OVERLAPS does exacly that
Date: 2025-10-29 13:52:38
Message-ID: 2b831e6818fb193e4826da7d087816cdf3e56c98.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, 2025-10-29 at 17:43 +0500, Kirill Reshke wrote:
> On Wed, 29 Oct 2025 at 16:31, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:
> >
> >
> > I think I see what you mean:
> >
> > CREATE TABLE temp (
> > id bigint NOT NULL,
> > valid tstzrange NOT NULL,
> > CONSTRAINT temp_pkey PRIMARY KEY (id, valid WITHOUT OVERLAPS)
> > );
> >
> > SELECT pg_get_indexdef('temp_pkey'::regclass);
> >
> > pg_get_indexdef
> > ----------------------------------------------------------------------
> > CREATE UNIQUE INDEX temp_pkey ON laurenz.temp USING gist (id, valid)
> >
> > That CREATE INDEX statement won't work.
> >
> > Yours,
> > Laurenz Albe
> >
> >
>
> Yep, this is probably a valid rewording of the first email. Is it a
> problem that is worth fixing?

I personally think so, although the fact that this occurs in the regression tests
might mean that it is intentional.

Anyway, here is a patch that fixes the problem for me. I am not happy with it,
because it hard-codes that CREATE UNIQUE INDEX only works with B-tree indexes,
but I don't have a better idea.

Yours,
Laurenz Albe

Attachment Content-Type Size
v1-0001-Fix-pg_get_indexdef-for-temporal-constraints.patch text/x-patch 7.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-10-29 14:17:28 Re: BUG #19097: System catalog modifications are allowed by alter
Previous Message Kirill Reshke 2025-10-29 12:43:18 Re: BUG #19098: Can't create unique gist index, where pg_indexes says that WITHOUT OVERLAPS does exacly that