【发布时间】:2012-01-09 03:52:18
【问题描述】:
我有一个date_dimension 表定义:
CREATE TABLE date_dimension
(
id integer primary key,
date text,
year double precision,
year_for_week double precision,
quarter double precision
);
我正在尝试创建一个失败的fact 表
create table fact (
id serial primary key,
contract integer,
component integer,
evaluation_date integer,
effective_date integer,
foreign key (evaluation_date, effective_date) references date_dimension(id, id)
);
错误是:
ERROR: there is no unique constraint matching given keys for referenced
table "date_dimension"
SQL state: 42830
我不知道如何解决这个问题。
【问题讨论】:
标签: sql postgresql