PostgreSQL主键是serial类型,但无法建立外键? rt外键是int类型的,不能建立外键。不能解决吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以啊你的 create table 语句是什么?贴出来,大家可以测试一下。 create table DG (ID SERIAL (10) not null,PID NUMERIC(5) null,NAME VARCHAR(64) not null,constraint PK_M2MNAP_DG primary key (ID));alter table DG add constraint FK_M2MNAP_DG_SELF foreign key (PID) references DG (ID) on delete restrict on update restrict;建立外键无法成功,错误提示说数据类型不一直,表的主键是NUMERIC就没为题。数字与字符串做主外键也有这个问题。 改表PID字段为integer reate table DG (ID SERIAL (10) not null,PID integer null,NAME VARCHAR(64) not null, 字段类型要一致,SERIAL是INT型,将PID修改为INT telnet 127.0.0.1 3306 连接失败 mysql函数 加分100 sqlyog的用户和密码正确。却无法登陆。在DOS地下正常。 (postgres)关于查询表的存储过程。 MySQL同步复制支持BLOB字段吗? 谁能给个Mysql图形界面的工具啊!要免费 mysql的sql语句中 字符串转换为数字的问题 这个子查询为何不行 如何将.dbf文件导入MYSQL? mysql group by where 性能调优 工厂模式 问题 求SQL(insert)语句
ID SERIAL (10) not null,
PID NUMERIC(5) null,
NAME VARCHAR(64) not null,
constraint PK_M2MNAP_DG primary key (ID)
);alter table DG
add constraint FK_M2MNAP_DG_SELF foreign key (PID)
references DG (ID)
on delete restrict on update restrict;建立外键无法成功,错误提示说数据类型不一直,
表的主键是NUMERIC就没为题。数字与字符串做主外键也有这个问题。
ID SERIAL (10) not null,
PID integer null,
NAME VARCHAR(64) not null,