On Tue, 2002-06-25 at 01:08, [EMAIL PROTECTED] wrote:
> Your message cannot be posted because it appears to be either spam or
> simply off topic to our filter. To bypass the filter you must include
> one of the following words in your message:
> 
> sql,query
> 
> If you just reply to this message, and include the entire text of it in the
> reply, your reply will go through. However, you should
> first review the text of the message to make sure it has something to do
> with MySQL. Just typing the word MySQL once will be sufficient, for example.
> 
> You have written the following:
> 
> On Mon, 2002-06-24 at 17:50, Roger Baklund wrote:
> > * [EMAIL PROTECTED] 
> > [...]
> > > The referred to keys are the same type and are indexed (they are
> > [...]
> > > CREATE TABLE genres (
> > >   genre_id        SMALLINT NOT NULL PRIMARY KEY,
> > [...]
> > >   genre_id        SMALLINT,
> > 
> > ...does not look the same to me... ;)
> 
> Ouch, you are correct, although they are the same *type*. However, this
> seems like a fairly severe restriction. Obviously a primary key must be
> NOT NULL, but there are certainly cases where a column which refers to a
> foreign key must be NULL. The docs do say that the foreign key
> constraints *can* have an ON DELETE SET NULL clause, which is
> meaningless if your column has to be set to NOT NULL due to referring to
> a primary key.
> 
> Perhaps this is only a deficiency, and not a bug, but the documentation
> could be a bit clearer on this. It says, "Corresponding columns in the
> foreign key and the referenced key must have similar internal data types
> inside InnoDB so that they can be compared without a type conversion."
> My understanding is that NOT NULL is only a column constraint and
> doesn't affect the data type.
> 
> However... Even when I set the referring column to be SMALLINT NOT NULL,
> and create a new database, I still get the same error:
> 
> ERROR 1005 at line 23: Can't create table './MP3d/tracks.frm' (errno:
> 150)
> 
> -- 
> Andy Dustman         PGP: 0x930B8AB6
>     @       .net     http://dustman.net/andy
> "Cogito, ergo sum." -- Rene Descartes
> "I yam what I yam and that's all what I yam." -- Popeye
> 
-- 
Andy Dustman         PGP: 0x930B8AB6
    @       .net     http://dustman.net/andy
"Cogito, ergo sum." -- Rene Descartes
"I yam what I yam and that's all what I yam." -- Popeye

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to