constraint via selection

Поиск
Список
Период
Сортировка
От Horst Herb
Тема constraint via selection
Дата
Msg-id 20011117121312.5700.qmail@gnumed.dhs.org
обсуждение исходный текст
Ответы Re: constraint via selection  (Horst Herb <hherb@malleenet.net.au>)
Список pgsql-sql
Dear list, 

I have two simplified tables "country" and "location":

create table country (code char(2) primary key,name varchar(60)
);

create table location (id serial primary key,country char(2) references country(code),[...]
);

Location should have a foreign key to country.code, but for performance & 
ressource reasons it would be much better to have a copy of the country 
code in location.country rather than a foreign key:

create table location (id serial primary key,country char(2) check ...
);

What would the most efficient formulation of the "check" constraint be in 
this case?

Horst


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

Предыдущее
От: Gurudutt
Дата:
Сообщение: Re: Joins!!
Следующее
От: Horst Herb
Дата:
Сообщение: Re: constraint via selection