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

From Tom Lane
Subject Re: BUG #19098: Can't create unique gist index, where pg_indexes says that WITHOUT OVERLAPS does exacly that
Date
Msg-id 2748212.1761750444@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #19098: Can't create unique gist index, where pg_indexes says that WITHOUT OVERLAPS does exacly that  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: BUG #19098: Can't create unique gist index, where pg_indexes says that WITHOUT OVERLAPS does exacly that
List pgsql-bugs
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



pgsql-bugs by date:

Previous
From: Kirill Reshke
Date:
Subject: Re: BUG #19098: Can't create unique gist index, where pg_indexes says that WITHOUT OVERLAPS does exacly that
Next
From: Peter Eisentraut
Date:
Subject: Re: BUG #19042: Option --help not recognized at the end of command line in pg_restore