Re: Foreign Unique Constraint

From: "Phillip Smith" <phillip(dot)smith(at)weatherbeeta(dot)com(dot)au>
To: "'Peter Eisentraut'" <peter_e(at)gmx(dot)net>, <pgsql-sql(at)postgresql(dot)org>
Cc: "'Jon Horsman'" <horshaq(at)gmail(dot)com>
Subject: Re: Foreign Unique Constraint
Date: 2007-03-28 22:21:31
Message-ID: 004501c77187$703ae4e0$9b0014ac@wbaus090
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Is that an 8.2 thing? I'm sure I've done it before, probably in 8.1

Maybe it was a trigger I did it in - I can't remember what I had for
breakfast, let alone a slow sub-query I did months ago :P

Cheers,
~p

-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org]
On Behalf Of Peter Eisentraut
Sent: Wednesday, 28 March 2007 19:08
To: pgsql-sql(at)postgresql(dot)org
Cc: Phillip Smith; 'Jon Horsman'
Subject: Re: [SQL] Foreign Unique Constraint

Am Mittwoch, 28. März 2007 00:17 schrieb Phillip Smith:
> Perhaps this...? It would work, but depending how many rows are in the
> table, it could become incredibly slow.
>
> ALTER TABLE table1 ADD CHECK (extension NOT IN (SELECT extension FROM
> table2));

Subqueries are not allowed in check constraints.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

*******************Confidentiality and Privilege Notice*******************

The material contained in this message is privileged and confidential to
the addressee. If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.

Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Phillip Smith 2007-03-29 05:35:52 SELECT INSTEAD
Previous Message Andrew Sullivan 2007-03-28 21:49:54 Re: Track query status