Re: primary key/foreign key constraints with InnoDB

2003-04-02 Thread Jeff Mathis
thanks for the advice Stephen. I'll admit though I am somewhat loathe to adding an artifical row in the other tables, but it may not be a bad way to go. In the past, I've written triggers to do this kind of check, but mysql doesn't yet support triggers. what I ended up doing is carefully rethinkin

Re: primary key/foreign key constraints with InnoDB

2003-04-02 Thread Stephen Giese
Jeff, We faced a similar challenge in an application: Each child record must have a parent in one of two tables, TabA or TabB, but not both. We "solved" it by adding a foreign-key field for each possible parent in the child table. Each column can have the FK constraint. We were using Sybase,

Re: primary key/foreign key constraints with InnoDB

2003-04-02 Thread Jeff Mathis
Thanks, but I think the lik you provided won't help. I know how to create pk/fk contraints, and do in our schema, when the foreign key is completely specified. for example, if my original table was instead: create table Example ( id int not null auto_increment primary key, fk_id int

Re: primary key/foreign key constraints with InnoDB

2003-04-01 Thread Stefan Hinz
Jeff, > I'm wondering if its somehow possible to create a pk/fk constraint for > the table below > create table Example ( > id int not null auto_increment primary key, > table_name enum('TabA','TabB') not null, > table_id int not null > ) type = InnoDB; > if table_name is

primary key/foreign key constraints with InnoDB

2003-04-01 Thread Jeff Mathis
hello all, I'm wondering if its somehow possible to create a pk/fk constraint for the table below create table Example ( id int not null auto_increment primary key, table_name enum('TabA','TabB') not null, table_id int not null ) type = InnoDB; if table_name is 'TabA', th