在postgresql里建表的有关问题

在postgresql里建表的问题

/*==============================================================*/

/* DBMS name: PostgreSQL 8 */

/* Created on: 2008-1-18 21:38:04 */

/*==============================================================*/

drop table T_MENU;

drop table T_ROLE;

drop table T_ROLEMENU;

drop table T_USER;

drop table T_USERROLE;

/*==============================================================*/

/* Table: T_MENU */

/*==============================================================*/

create table T_MENU (

  id number(2) not null,

  menu_id number(2) null,

  menu_name varchar(10) null,

  menu_link varchar(200) null,

  constraint PK_T_MENU primary key (id)

);

/*==============================================================*/

/* Table: T_ROLE */

/*==============================================================*/

create table T_ROLE (

  id number(2) not null,

  role_id number(2) null,

  role_name varchar(10) null,

  constraint PK_T_ROLE primary key (id)

);

/*==============================================================*/

/* Table: T_ROLEMENU */

/*==============================================================*/

create table T_ROLEMENU (

  T_M_id number(2) null,

  id number(2) null

);

/*==============================================================*/

/* Table: T_USER */

/*==============================================================*/

create table T_USER (

  id number(4) not null,

  user_id number(4) null,

  user_password VARCHAR(8) null,

  user_role number(2) null,

  user_gender VARCHAR(1) null,

  user_email varchar(20) null,

  constraint PK_T_USER primary key (id)

);

/*==============================================================*/

/* Table: T_USERROLE */

/*==============================================================*/

create table T_USERROLE (

  id number(4) null,

  T_R_id number(2) null

);

alter table T_ROLEMENU

  add constraint FK_TABLE_5_REFE foreign key (T_M_id)

  references T_MENU (id)

  on delete restrict on update restrict;

alter table T_ROLEMENU

  add constraint FK_TABLE_5_REF2 foreign key (id)

  references T_ROLE (id)

  on delete restrict on update restrict;

alter table T_USERROLE

  add constraint FK_T_USERRO_REF foreign key (id)

  references T_USER (id)

  on delete restrict on update restrict;

alter table T_USERROLE

  add constraint FK_T_USERRO_RE2 foreign key (T_R_id)

  references T_ROLE (id)

  on delete restrict on update restrict;

上边是用powerdesginer生成的sql语句

我将他导入postgresql出现了错误

ERROR: syntax error at or near “(”

SQL 状态: 42601

字符:632

不知道是哪出了毛病!请高手请教

——解决方案———–

在postgresql里建表的有关问题

相关文章:

你感兴趣的文章:

标签云: