pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: n.bartek3762@gmail.com, pgsql-bugs@lists.postgresql.org, "Paul A. Jungwirth" <pj@illuminatedcomputing.com>
Cc: Peter Eisentraut <peter@eisentraut.org>
Subject: Re: BUG #19098: Can't create unique gist index, where pg_indexes says that WITHOUT OVERLAPS does exacly that
Date: Wed, 29 Oct 2025 11:07:24 -0400
Message-ID: <2748212.1761750444@sss.pgh.pa.us> (raw)
In-Reply-To: <11e73b0d2d89476fb04e6055a80638f776bb6f18.camel@cybertec.at>
References: <19098-7f8deb5093c13da2@postgresql.org>
	<11e73b0d2d89476fb04e6055a80638f776bb6f18.camel@cybertec.at>

Laurenz Albe <laurenz.albe@cybertec.at> writes:
> 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)
>   );

[ Note that this example requires having installed btree_gist ]

>   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.

Yes.  That is a pretty serious oversight in fc0438b4e.  But I don't
think your patch proposal of just suppressing the UNIQUE keyword in
pg_get_indexdef_worker improves matters, because that presumably would
result in building an index that doesn't enforce the constraint.

I have not looked at the WITHOUT OVERLAPS patch, but if the mechanism
underlying that is just to set pg_index.indisunique, then it seems
like a reasonable answer here is to allow this syntax.  The question
we have is how CREATE INDEX can know that UNIQUE is supported for
index types other than btrees.

			regards, tom lane





view thread (16+ messages)  latest in thread

Message-ID: <2748212.1761750444@sss.pgh.pa.us>
Permalink:  ../2748212.1761750444@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2748212.1761750444@sss.pgh.pa.us

 · 

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: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, laurenz.albe@cybertec.at, pj@illuminatedcomputing.com, peter@eisentraut.org
  Subject: Re: BUG #19098: Can't create unique gist index, where pg_indexes says that WITHOUT OVERLAPS does exacly that
  In-Reply-To: <2748212.1761750444@sss.pgh.pa.us>

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

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