0
create table date_dimension (
id serial primary key,
date_id date,
..... others
);
create table temp (
id serial primary key,
from_date integer,
to_date integer,
value integer,
foreign key (from_date, to_date) references date_dimension(id, id)
);
は、どのように私はdate_dimension
にid
フィールドにfrom_date
とto_date
の両方を参照することができますか?
現在のコードは言っのPostgres:同じ主キーフィールドに2つの外部キー
ERROR: there is no unique constraint matching given keys for referenced table "date_dimension"
はありがとうございますことをやって失敗し
各FOREIGN KEY
制約は常にreferantに行*への参照テーブルに行に関連しますテーブルに追加
私は今これを見ています - 関係の "ID"列 "date_dimension"はすでに存在します – daydreamer
@daydreamer:あなたがこれまで持っていたすべてのコードで新しい質問をしてください。 – SingleNegationElimination
こんにちは@TokenMacGuy、これは私の愚かさ、あなたのソリューションの岩です!ありがとうございます:) – daydreamer