Re: FK Constraint on index not PK - Mailing list pgsql-general

From Tom Lane
Subject Re: FK Constraint on index not PK
Date
Msg-id 24951.1168705867@sss.pgh.pa.us
Whole thread Raw
In response to Re: FK Constraint on index not PK  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-general
Alvaro Herrera <alvherre@commandprompt.com> writes:
> The problem is that the constraint was defined with a dependence on the
> second index.  I guess what you could do is drop the constraint, drop
> the second index, and then recreate the constraint.  Try it within a
> transaction block, just in case it doesn't work (but I don't see why it
> wouldn't)

That's certainly the safest way, but if this is a live production
database then the time spent holding exclusive locks while
re-establishing the FK constraint may be a problem.  If that's not
tolerable then the solution is manually mucking with the system
catalogs as I suggested in an earlier reply.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problems with unique restrictions
Next
From: Tom Lane
Date:
Subject: Re: index type for indexing long texts