More ADD CONSTRAINT behaviour questions

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: More ADD CONSTRAINT behaviour questions
Date: 2001-07-10 01:39:11
Message-ID: ECEHIKNFIMMECLEBJFIGGEDJCBAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike Castle 2001-07-10 01:46:10 Re: Re: Backups WAS: 2 gig file size limit
Previous Message Joseph Shraibman 2001-07-10 00:59:59 Re: Re: Backups WAS: 2 gig file size limit