pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-sql@postgresql.org
Subject: Re: Foreign Unique Constraint
Date: Tue, 27 Mar 2007 15:36:42 +0200
Message-ID: <20070327133642.GB19137@a-kretschmer.de> (raw)
In-Reply-To: <4f4c2a010703270621h5137a4e5rb515a9be9034a543@mail.gmail.com>
References: <4f4c2a010703270621h5137a4e5rb515a9be9034a543@mail.gmail.com>

am  Tue, dem 27.03.2007, um  9:21:44 -0400 mailte Jon Horsman folgendes:
> I was wondering if someone could help point me in the right direction
> w.r.t. foreign unique constraints.  I'm working on a legacy database
> and have a new requirement and am not sure how to do it.
> 
> I have something like this
> 
> create table table1 (
> id SERIAL PRIMARY KEY
> extension UNIQUE,

I can't find anything about this syntax in the docs...

> 
> Basically table 1 and table 2 both have the concept of an extension
> that must be unique but the rest of the info in the tables are
> different.  I need to ensure that if i add an entry to table 1 with
> extension 1000 that it will fail if there is already an entry in
> table2 with the same extension.

I think, you should write a TRIGGER for this.


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net



view thread (11+ messages)  latest in thread

Message-ID: <20070327133642.GB19137@a-kretschmer.de>
Permalink:  ../20070327133642.GB19137@a-kretschmer.de/
Also on:    postgresql.org/message-id/20070327133642.GB19137@a-kretschmer.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: andreas.kretschmer@schollglas.com
  Subject: Re: Foreign Unique Constraint
  In-Reply-To: <20070327133642.GB19137@a-kretschmer.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox