Re: [pgsql-advocacy] MySQLs' "FOREIGN KEYS¨

Поиск
Список
Период
Сортировка
От Jan Wieck
Тема Re: [pgsql-advocacy] MySQLs' "FOREIGN KEYS¨
Дата
Msg-id 3FAD804E.5050309@Yahoo.com
обсуждение исходный текст
Ответ на MySQLs' "FOREIGN KEYS¨  (Rajesh Kumar Mallah <mallah@trade-india.com>)
Ответы Re: MySQLs' "FOREIGN KEYS¨  (Rajesh Kumar Mallah <mallah@trade-india.com>)
Список pgsql-advocacy
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)


--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



В списке pgsql-advocacy по дате отправления:

Предыдущее
От: "Dave Page"
Дата:
Сообщение: Re: [HACKERS] Changes to Contributor List
Следующее
От: Rajesh Kumar Mallah
Дата:
Сообщение: Re: MySQLs' "FOREIGN KEYS¨