Re: More ADD CONSTRAINT behaviour questions

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: More ADD CONSTRAINT behaviour questions
Date: 2001-07-10 03:32:28
Message-ID: 200107100332.f6A3WSE18908@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> > 6. A unique index is already defined over (b, a)
>
> > - As above. Technically a different index, but effect
> > as far as uniqueness is concerned is identical?
>
> This case *must not* be an error IMHO: it's perfectly reasonable to have
> indexes on both (a,b) and (b,a), and if the column pair happens to be
> unique, there's no reason why they shouldn't both be marked unique.
>
> Because of that, I'm not too excited about raising an error in any case
> except where you have an absolutely identical pre-existing index, ie,
> there's already a unique index on (a,b) --- doesn't matter much whether
> it's marked primary or not.
>
> For ADD PRIMARY KEY, there mustn't be any pre-existing primary index,
> of course. I can see promoting an extant matching unique index to
> primary status, though, rather than making another index.
>

Yea, I agree with Tom. Usually we let the person do whatever they want
except in cases that clearly make no sense or where we can improve it.

Good questions, though.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephan Szabo 2001-07-10 03:33:49 Re: More ADD CONSTRAINT behaviour questions
Previous Message Thomas Lockhart 2001-07-10 02:42:52 Re: Mozilla 1.0 release soon?