Re: FOREIGN KEY Reference on multiple columns - Mailing list pgsql-sql

From Weiss, Jörg
Subject Re: FOREIGN KEY Reference on multiple columns
Date
Msg-id 4B4E89127868BD458A795430BCF4FD1328C51ACB@DVZSN-RA0325.bk.dvz-mv.net
Whole thread Raw
In response to Re: FOREIGN KEY Reference on multiple columns  (Luca Vernini <lucazeo@gmail.com>)
Responses Re: FOREIGN KEY Reference on multiple columns
Re: FOREIGN KEY Reference on multiple columns
List pgsql-sql
> -----Ursprüngliche Nachricht-----
> Von: Luca Vernini [mailto:lucazeo@gmail.com] 
> Gesendet: Dienstag, 23. September 2014 11:59
> An: Weiss, Jörg
> Cc: pgsql-sql@postgresql.org
> Betreff: Re: [SQL] FOREIGN KEY Reference on multiple columns
>
> 2014-09-23 11:54 GMT+02:00 Weiss, Jörg <J.Weiss@dvz-mv.de>:
> > Hi!
> Hi.
>
> > Is it possible to create a “FOREIGN KEY CONSTRAINT” with references to
> > multiple columns of the reference table?
>
> Yes, it is.
>
> see here:
> http://www.postgresql.org/docs/9.3/static/ddl-constraints.html
> Section 5.3.5 there are some examples. One of them has multiple
> columns, just like your case.
>
> > Regards …
>
> Regards.

Thank you!

Do you mean this example?
CREATE TABLE t1 ( a integer PRIMARY KEY, b integer, c integer, FOREIGN KEY (b, c) REFERENCES other_table (c1, c2)
);
This is not, what I want.

In my case it should be something like this: 
CREATE TABLE t1 ( a integer PRIMARY KEY, b integer, c integer, FOREIGN KEY (b) REFERENCES other_table (c1,
c2='c2Value')
);
This example does not work. But I think you can see, what I mean.



pgsql-sql by date:

Previous
From: Luca Vernini
Date:
Subject: Re: FOREIGN KEY Reference on multiple columns
Next
From: Luca Vernini
Date:
Subject: Re: FOREIGN KEY Reference on multiple columns