Re: are foreign keys realized as indexes?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Felix Kater <fkater(at)googlemail(dot)com>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: are foreign keys realized as indexes?
Date: 2007-05-09 14:39:25
Message-ID: 26668.1178721565@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Felix Kater <fkater(at)googlemail(dot)com> writes:
> On Tue, 8 May 2007 15:54:08 +0200
> Martijn van Oosterhout <kleptog(at)svana(dot)org> wrote:
>> A unique index is not a "substitute" for a unique constraint, they're
>> exactly the same thing.

> Yes. For this reason I didn't have to implement *both* 'unique
> constraints' *and* 'unique indices' in my pg interface.

If you are trying to get away with a dumbed-down subset of SQL, be
prepared for people to refuse to use your tool ;-).

You have to support the unique-constraint syntax because the SQL spec
says so (and people are used to it), and you have to support the
create-index syntax because it gives access to functionality not
available through the constraint syntax. Unique indexes on expressions
for instance.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2007-05-09 14:42:49 Re: In theory question
Previous Message Scott Ribe 2007-05-09 14:26:52 Re: Dangers of fsync = off