Search Postgresql Archives

Re: Checking Multiplicity Constraints and Retrieving

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux