No unique constraint matching given keys for referenced table

后端 未结 3 1037
臣服心动
臣服心动 2021-01-17 08:37

I have a date_dimension table definition:

CREATE TABLE date_dimension
(
  id integer primary key,
  date text,
  year double precision,
  year         


        
3条回答
  •  天涯浪人
    2021-01-17 09:23

    Don't you just want to create two separate foreign key references to the date dimension as follows:

    create table fact ( 
        id serial primary key,
        contract integer,
        component integer,
        evaluation_date integer,
        effective_date integer,
        foreign key (evaluation_date) references date_dimension(id),
        foreign key (effective_date) references date_dimension(id)
    );
    

提交回复
热议问题