Re: Checking Multiplicity Constraints and Retrieving

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: Checking Multiplicity Constraints and Retrieving
Дата
Msg-id 1129843929.8300.799.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Checking Multiplicity Constraints and Retrieving Data from Error Messages  (Ledina Hido <lh1101@ecs.soton.ac.uk>)
Список pgsql-general
On Wed, 2005-10-19 at 15:25 +0100, Ledina Hido wrote:

> First of all, is there any way of limiting the number of rows in a
> table, referencing to the same element of another table? For example,
> force a manager not to have more than 10 employees under his control.
> In a way this can be seen as checking the multiplicity of the
> relation between the two tables. I know one way would be using
> triggers, but I was wondering if there was a way of specifying this
> when the table is constructed.

That's a lack of function within the SQL standard and PostgreSQL doesn't
implement that as an extension.

XML Schema allows you to define minoccurs and maxoccurs, but not the
SQL:2003 standard.

It would be very cool if it did, I grant you. You have to do this
yourself via a trigger. Just make sure you create an index on the
columns and you'll be fine - apart from the extra cost of inserting
rows, so keep maxoccurs small.

Best Regards, Simon Riggs


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

Предыдущее
От: Richard_D_Levine@raytheon.com
Дата:
Сообщение: Re: [HACKERS] 'a' == 'a '
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] 'a' == 'a '