| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
| Cc: | Felix Kater <fkater(at)googlemail(dot)com>, rod(at)iol(dot)ie, pgsql-general(at)postgresql(dot)org |
| Subject: | Re: are foreign keys realized as indexes? |
| Date: | 2007-05-08 14:06:44 |
| Message-ID: | 556.1178633204@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> On Tue, May 08, 2007 at 02:14:54PM +0200, Felix Kater wrote:
>> There is *no complete* substitute for foreign keys by using *indexes*
>> since I'd loose the referencial integrity (whereas for unique contraints
>> there *is* a full replacement using indexes)?
> A unique index is not a "substitute" for a unique constraint, they're
> exactly the same thing. If you drop your constraint and create a unique
> index, you're back where you started. You neither added nor removed
> anything.
Well, actually you added or removed a pg_constraint entry associated
with the index ... but either way it's the unique index that really
does the work of enforcing uniqueness.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrew Sullivan | 2007-05-08 14:09:21 | Re: Dangers of fsync = off |
| Previous Message | Tom Lane | 2007-05-08 14:03:24 | Re: pg_contraint: 'action code' ? |