Re: Re: Problem with inheritance

Поиск
Список
Период
Сортировка
От Marc SCHAEFER
Тема Re: Re: Problem with inheritance
Дата
Msg-id Pine.LNX.3.96.1010127092106.1091A-100000@defian.alphanet.ch
обсуждение исходный текст
Ответ на Re: Problem with inheritance  (Alfonso Peniche <alfonso@iteso.mx>)
Ответы Search engine doesn't work  (Marc SCHAEFER <schaefer@alphanet.ch>)
Список pgsql-general
On Fri, 26 Jan 2001, Alfonso Peniche wrote:

> I like the idea, there's just one problem, a user can be both a student and an
> employee...

- If the guy is an user only, then just fill the user template
- If the guy is a student, add a tuple to the is_student relation.
- If the guy is an employee, add a tuple to the is_employee relation.

You do not need to delete the is_student if you insert into is_employee
(and backwards).

The only problem that I see with my approach is that you can create an
user which isn't neither a student nor an employee: if this is an issue
you might want to
periodically run a query like:

   SELECT u.*
   FROM user u
   WHERE (u.id NOT IN (SELECT user_id FROM is_student))
     AND (u.id NOT IN (SELECT user_id FROM is_employee))

to spot illegal entries.

(haven't tried it, though).

Or someone from the PostgreSQL or SQL experts could tell us if there is a
way to do cross-table integrity checking ?



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 2 or more columns of type 'serial' in a table
Следующее
От: "Oliver Elphick"
Дата:
Сообщение: Re: get last sequence