Re: NULL Foreign Key
| От | Manfred Koizar |
|---|---|
| Тема | Re: NULL Foreign Key |
| Дата | |
| Msg-id | fdpajuog4ra0cuuntlfa2b05350js74ct1@4ax.com обсуждение исходный текст |
| Ответ на | NULL Foreign Key ("Kuhn, Dylan K (NDTI)" <KuhnDK@navair.navy.mil>) |
| Список | pgsql-general |
On Tue, 16 Jul 2002 17:10:32 -0700, "Kuhn, Dylan K (NDTI)" <KuhnDK@navair.navy.mil> wrote: >Can I make a foreign key that is allowed to be NULL? Yes: fred=# CREATE TABLE father (i INT PRIMARY KEY); NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'father_pkey' for table 'father' CREATE fred=# CREATE TABLE son (i INT REFERENCES father); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) CREATE fred=# INSERT INTO father VALUES (1); INSERT 183317 1 fred=# INSERT INTO son VALUES (1); INSERT 183318 1 fred=# INSERT INTO son VALUES (2); ERROR: <unnamed> referential integrity violation - key referenced from son not found in father fred=# INSERT INTO son VALUES (NULL); INSERT 183320 1 Servus Manfred
В списке pgsql-general по дате отправления: