Re: Why does Postgres allow duplicate (FK) constraints

From: Alban Hertroys <haramrae(at)gmail(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why does Postgres allow duplicate (FK) constraints
Date: 2013-03-26 16:17:36
Message-ID: CAF-3MvN40FiuBMCA5Q4kLYqmnduTbGoHdUKVaJmJqt5JRe-TeQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 26 March 2013 17:07, Thomas Kellerer <spam_eater(at)gmx(dot)net> wrote:

> Is there anything in the standard that actively requires that you can
>>> create two "identical" constraints?
>>
>>
> Because technically it simply doesn't make sense, does it?
>

It can make sense during a maintenance window, if you create a new
(redundant) FK constraint concurrently to replace the existing one. If
you'd first remove the existing constraint, you're allowing FK violations
until the new constraint has finished creating its index.

This happens for example if you want to use a different index algorithm,
say a gist index instead of a btree index, or if the initial index has
gotten corrupt somehow and it needs reindexing.
--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2013-03-26 17:47:30 Unexpected behaviour of encode()
Previous Message Tom Lane 2013-03-26 16:16:08 Re: Why does Postgres allow duplicate (FK) constraints