ALTER TYPE 1: recheck index-based constraints - Mailing list pgsql-hackers

From Noah Misch
Subject ALTER TYPE 1: recheck index-based constraints
Date
Msg-id 20110109220023.GB5777@tornado.leadboat.com
Whole thread Raw
Responses Re: ALTER TYPE 1: recheck index-based constraints  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
When ALTER TABLE rewrites a table, it reindexes, but the reindex does not
revalidate UNIQUE/EXCLUDE constraints.  This behaves badly in cases like this,
neglecting to throw an error on the new UNIQUE violation:

CREATE TABLE t (c numeric UNIQUE);
INSERT INTO t VALUES (1.1),(1.2);
ALTER TABLE t ALTER c TYPE int;

The comment gave a reason for skipping the checks: it would cause deadlocks when
we rewrite a system catalog.  So, this patch changes things to only skip the
check for system catalogs.

Attachment

pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: ALTER TYPE 0: Introduction; test cases
Next
From: Noah Misch
Date:
Subject: ALTER TYPE 2: skip already-provable no-work rewrites