Re: enforcing constraints across multiple tables

Поиск
Список
Период
Сортировка
От Tim Landscheidt
Тема Re: enforcing constraints across multiple tables
Дата
Msg-id m3iq57gcn9.fsf@passepartout.tim-landscheidt.de
обсуждение исходный текст
Ответ на enforcing constraints across multiple tables  (Andrew Geery <andrew.geery@gmail.com>)
Список pgsql-sql
Andrew Geery <andrew.geery@gmail.com> wrote:

> [...]
> My questions are:
> (A) Is there a way to check (2) above using a constraint and not a trigger?
> (B) Is there an easier way to solve this problem?  Does the complicated
> nature of the solution make the design poor?
> (C) Should I not worry about this constraint at the DB level and just
> enforce it at the application level?
> [...]

I don't know about (A) and (B), but (C) is the solution of
choice in most complex cases. It's usually *much* easier to
enforce than with constraints and triggers (you have to do
it at application level anyway as well as you probably don't
want to pass PostgreSQL's errors directly to the user) and
your mind doesn't become twisted too much. I would schedule
regular tests on the data set though to ensure that you no-
tice problems early on.

Tim



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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: COPY command and required file permissions
Следующее
От: Ireneusz Pluta
Дата:
Сообщение: Re: Average of Array?