From: | Luca Vernini <lucazeo(at)gmail(dot)com> |
---|---|
To: | Weiss, Jörg <J(dot)Weiss(at)dvz-mv(dot)de> |
Cc: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: FOREIGN KEY Reference on multiple columns |
Date: | 2014-09-23 12:36:47 |
Message-ID: | CAHZ=uVDa4cyfoEk5D5jeOJqmYgmf6PNJs59OSFtmqP0WBfN0+g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Sorry, I don't get your problem.
In first example there was a where, in second case:
FOREIGN KEY (b) REFERENCES other_table (c1, c2='c2Value')
You mean b must be equal to what?
Try to include real table script.
Probably you can use a check.
Regards,
Luca.
2014-09-23 13:38 GMT+02:00 Weiss, Jörg <J(dot)Weiss(at)dvz-mv(dot)de>:
>> -----Ursprüngliche Nachricht-----
>> Von: Luca Vernini [mailto:lucazeo(at)gmail(dot)com]
>> Gesendet: Dienstag, 23. September 2014 11:59
>> An: Weiss, Jörg
>> Cc: pgsql-sql(at)postgresql(dot)org
>> Betreff: Re: [SQL] FOREIGN KEY Reference on multiple columns
>>
>> 2014-09-23 11:54 GMT+02:00 Weiss, Jörg <J(dot)Weiss(at)dvz-mv(dot)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.
>
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
From | Date | Subject | |
---|---|---|---|
Next Message | 2014-09-23 13:10:42 | Re: FOREIGN KEY Reference on multiple columns | |
Previous Message | 2014-09-23 11:38:10 | Re: FOREIGN KEY Reference on multiple columns |