Disallow unique index on system columns - Mailing list pgsql-hackers

From David Rowley
Subject Disallow unique index on system columns
Date
Msg-id CAKJS1f8TQYgTRDyF1_u9PVCKWRWz+DkieH=U7954HeHVPJKaKg@mail.gmail.com
Whole thread Raw
Responses Re: Disallow unique index on system columns
List pgsql-hackers
Hi,

Over in [1], while I was aiming to fix some incorrect formatting in an
error message, Tom noticed that the code in that area was much more
broken than I had thought.

Basically, if you do;

postgres=# create table t (a int) with oids;
CREATE TABLE
postgres=# create unique index t_oid_idx on t(oid);
CREATE INDEX
postgres=# alter table t replica identity using index t_oid_idx;

You get;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

I proposed a fix over there, but it didn't go anywhere, probably
because Tom and Andres discussed just disallowing unique indexes on
system columns altogether. So, the attached patch does just that, and
also fixes up the replica identity bugs too, as it's still possible
that someone could create a unique index on a system column with an
old version, upgrade, then try to set the replica identity to that
index. We'd need to handle that correctly, so I fixed that too.

I hope there's still time to get this backpacked before the releases.

[1] http://www.postgresql.org/message-id/26659.1459485031@sss.pgh.pa.us

--
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Draft release notes for next week's releases
Next
From: Tom Lane
Date:
Subject: Re: Disallow unique index on system columns