List:General Discussion« Previous MessageNext Message »
From:Martijn Tonies Date:October 8 2004 10:52am
Subject:Re: Naming constraints
View as plain text  
Hello,

> I have problem in naming foreign key constraints :

--8<--

> Actually, the name for the just created constraint is an 'internally
> generated id'  (i.e :0_023), so the update script can't find the named
> constraint 'fktblnumb'
>
> The "show create table tblnumbers" outputs :
>
> CREATE TABLE `tblnumbers` (
>   `numid` int(11) NOT NULL auto_increment,
>   `nameid` int(11) default NULL,
>   `phone` varchar(20) default NULL,
>   PRIMARY KEY  (`numid`),
>   KEY `nameid` (`nameid`),
>   CONSTRAINT `0_23` FOREIGN KEY (`nameid`) REFERENCES `tblphone`
(`nameid`),
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1
>
>
> Any idea about this behaviour ?

Yes, MySQL parses the named constraint, but doesn't apply
it and creates its own constraint name.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com

Thread
Naming constraintsRichard - CEDRICOM8 Oct
  • Re: Naming constraintsMartijn Tonies8 Oct
  • Re: Naming constraintsRichard - CEDRICOM8 Oct
  • Re: Naming constraintsMartijn Tonies8 Oct