MySQL Forums
Forum List  »  PostgreSQL

problems with postgres foreign keys
Posted by: Ignacio reg
Date: August 25, 2005 01:22PM

I am trying to create a primary key and foreign key which are referenced to that primary key in the same table.

But, I Can do it with Mysql.

here are my examples:

-- trying this
CREATE TABLE menu (
menu_id int auto_increment primary key,
menu_id_father int

) type=InnoDB;

ALTER TABLE menu add foreign key (menu_id_father) references menu ( menu_id);

error: Can't create table './proyect3/#sql-3db_36.frm' (errno: 150)

-- trying this:

CREATE TABLE menu (
menu_id int auto_increment primary key, foreign key (menu_id_father) references menu ( menu_id),
menu_id_father int
) type=InnoDB;

error: Can't create table './proyect3/#sql-3db_36.frm' (errno: 150)

please help

Options: ReplyQuote


Subject
Views
Written By
Posted
problems with postgres foreign keys
6461
August 25, 2005 01:22PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.