Re: MySQLs' "FOREIGN KEYS¨

From: Rajesh Kumar Mallah <mallah(at)trade-india(dot)com>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: pgsql-advocacy(at)postgresql(dot)org
Subject: Re: MySQLs' "FOREIGN KEYS¨
Date: 2003-11-10 03:12:13
Message-ID: 3FAF020D.5050104@trade-india.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy


Oops! really sorry , the tables were not of InnoDB type
that could have supported FKEYS. *Will post again* once
i get to put FKEYS properly on InnoDB tables.

Still in that case also the beast should tell loudly about
whats going on behind.

Mallah.

Jan Wieck wrote:

> Rajesh Kumar Mallah wrote:
>
>>
>> MySQL does not thinks 0 to be a valid integer data .
>> Although 0 is not present in master table
>> it allows inserting in a referencing table
>> as though 0 == NULL . This is really funny (dangerous)
>
>
> What does it do if you have a NOT NULL constraint on the FK column and
> insert 0?
>
>
> Jan
>
>>
>>
>> mysql> alter table slave add foreign key (id2) references master(id);
>> Query OK, 6 rows affected (0.00 sec)
>> Records: 6 Duplicates: 0 Warnings: 0
>>
>>
>> mysql> select * from master;
>> Empty set (0.00 sec)
>>
>> mysql>
>>
>>
>> mysql> select * from slave;
>> +------+
>> | id2 |
>> +------+
>> | 0 |
>> | 0 |
>> | 0 |
>> | 0 |
>> | 0 |
>> | 0 |
>> +------+
>> 6 rows in set (0.00 sec)
>
>
>

In response to

Responses

Browse pgsql-advocacy by date

  From Date Subject
Next Message Jeff 2003-11-10 13:04:48 Re: MySQLs' "FOREIGN KEYS¨
Previous Message Jan Wieck 2003-11-08 23:46:22 Re: [pgsql-advocacy] MySQLs' "FOREIGN KEYS¨