not sure about constraints

Поиск
Список
Период
Сортировка
От Jerome Alet
Тема not sure about constraints
Дата
Msg-id 20050902132356.GD10284@mail.librelogiciel.com
обсуждение исходный текст
Ответы Re: not sure about constraints  (Achilleus Mantzios <achill@matrix.gatewaynet.com>)
Список pgsql-sql
Hello,

I've got 4 tables :

CREATE TABLE tableA (id SERIAL PRIMARY KEY NOT NULL,                    blahA TEXT);                    
CREATE TABLE tableB (id SERIAL PRIMARY KEY NOT NULL,                    blahB TEXT);                    
CREATE TABLE tableC (id SERIAL PRIMARY KEY NOT NULL,                                         ida INT4 REFERENCES
tableA(id),                   idb INT4 REFERENCES tableB(id),                    blahC TEXT);                    
 
CREATE TABLE tableD    (id SERIAL PRIMARY KEY NOT NULL,                         ida INT4,    idb INT4,    blahC TEXT,
CONSTRAINT checkAB FOREIGN KEY (ida, idb) REFERENCES tableC(ida, idb));                    
 
Is the definition of tableD sufficient, or should I do it this way 
instead : 

CREATE TABLE tableD    (id SERIAL PRIMARY KEY NOT NULL,                         ida INT4 REFERENCES tableA(id),    idb
INT4REFERENCES tableB(id),    blahD TEXT,    CONSTRAINT checkAB FOREIGN KEY (ida, idb) REFERENCES tableC(ida, idb));
               
 
which looks superfluous to me.                     

???

Thanks in advance

Jerome Alet


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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: cursor "" already in use
Следующее
От: Achilleus Mantzios
Дата:
Сообщение: Re: not sure about constraints