Re: Feature Proposal: Constant Values in Columns or Foreign Keys

Поиск
Список
Период
Сортировка
От Nils Gösche
Тема Re: Feature Proposal: Constant Values in Columns or Foreign Keys
Дата
Msg-id 00eb01cd1d70$8377edb0$8a67c910$@de
обсуждение исходный текст
Ответ на Re: Feature Proposal: Constant Values in Columns or Foreign Keys  (Vincent Veyron <vv.lists@wanadoo.fr>)
Ответы Re: Feature Proposal: Constant Values in Columns or Foreign Keys
Список pgsql-general
Vincent Veyron wrote:

> use a trigger on each of the derived tables, that cancels any insert if
> the same id already exists in the other table?

Yes, that would work.

> You don't say how your data gets inserted, but considering how
> complicated your preferred option looks, I have to ask why you can't
> use something as simple as :

[...]

> You'll have to build the queries according to the value of type, but
> this should give you the features you mention?

Sure, this is what I meant when I said that you could simply omit the type
field. However, if you still want the guarantee about not having two derived
rows for the same base row, you'll have to use a trigger function. The whole
point of the exercise is to avoid that trigger function and replace it with
a simple foreign key :-).

It's ok, maybe it's not worth the trouble.

Regards,
--
Nils Gösche
"Don't ask for whom the <CTRL-G> tolls."



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

Предыдущее
От: Vincent Veyron
Дата:
Сообщение: Re: Feature Proposal: Constant Values in Columns or Foreign Keys
Следующее
От: Eliot Gable
Дата:
Сообщение: Re: LOCK TABLE is not allowed in a non-volatile function