我在 PostgreSQL 上有以下说明:
CREATE TABLE ACTOR(
ACT_CUIL NUMERIC(8,0) NOT NULL,
ACT_NOMBRE CHARACTER VARYING(25) NOT NULL,
ACT_APELLIDOPAT CHARACTER VARYING(25) NOT NULL,
ACT_APELLIDOMAT CHARACTER VARYING(25) NOT NULL,
ACT_NOMARTCO CHARACTER VARYING(25) NULL,
ACT_ROL CHARACTER VARYING(25) NOT NULL,
PRIMARY KEY (ACT_CUIL),
FOREIGN KEY (ID_ELEN) REFERENCES ELENCO(ID_ELEN)
);
来自 ACTOR 的主键被创建;但 pgAdmin 编译器告诉我:
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "actor_pkey" for table "actor"
ERROR: column "id_elen" referenced in foreign key constraint does not exist
********** Error **********
ERROR: column "id_elen" referenced in foreign key constraint does not exist
SQL state: 42703
关于这个我不知道是什么问题。我在http://www.postgresql.org/docs/8.1/static/ddl-constraints.html使用官方文档
感谢和问候