MySQL Forums
Forum List  »  General

Foriegn key problem with timestamp
Posted by: Thomas Sondag
Date: April 05, 2006 05:57AM

Hi all,

I have the folowing problem with Mysql 5.0.18 and Innodb backend :

create table test1 (id_test1 bigint not null, PRIMARY KEY (id_test1));
create table test2 (id_test2 bigint not null,time timestamp, time2 timestamp, id_test1 bigint NOT NULL);
ALTER TABLE test2 ADD CONSTRAINT fk1 FOREIGN KEY (id_test1) REFERENCES test1(id_test1);

Last line produce an error :
ERROR 1067 (42000): Invalid default value for 'time2'

It's works when I remove one timestamp from table test2 or when I use datetime rather than timestamp, I don't understand why, do I miss something in the documentation ?

Thanks in advance,
Thomas

Options: ReplyQuote


Subject
Written By
Posted
Foriegn key problem with timestamp
April 05, 2006 05:57AM


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.