More ADD CONSTRAINT behaviour questions - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject More ADD CONSTRAINT behaviour questions
Date
Msg-id ECEHIKNFIMMECLEBJFIGGEDJCBAA.chriskl@familyhealth.com.au
Whole thread Raw
Responses Re: More ADD CONSTRAINT behaviour questions
Re: More ADD CONSTRAINT behaviour questions
RE: More ADD CONSTRAINT behaviour questions
List pgsql-hackers
When someone issues this command:

ALTER TABLE test ADD UNIQUE (a, b);

What happens when:

1. A non-unique index is already defined over (a, b)
- Either add new index or promote existing one to unique?

2. A non-unique index is already defined over (b, a)
- As above?

3. A primary index is already defined over (a, b)
- ERROR: unique already implied by primary?

4. A primary index is already defined over (b, a)
- As above?

5. A unique index is already defined over (a, b)
- ERROR: unique index already exists over keys?

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?

7. No index exists over (a, b) or (b, a)
- Create a new unique index over (a, b)?

Chris




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: timestamp not consistent with documentation or standard
Next
From: Bruce Momjian
Date:
Subject: Mozilla 1.0 release soon?