Re: limiting number of allowed rows in a table

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Vanja <milosevski(at)gmail(dot)com>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: limiting number of allowed rows in a table
Date: 2005-12-28 15:00:00
Message-ID: BFD812A0.27DD%sdavis2@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 12/28/05 9:53 AM, "Vanja" <milosevski(at)gmail(dot)com> wrote:

> Can someone please tell me how can I add a constraint which will limit
> the number of rows that are allowed to be inserted in a table?

I don't think there is such a constraint (but would love to hear otherwise).
However, you could place a trigger on a table that does a count(*) on the
table (which might be time-consuming on a large table, but....) and then
does whatever you want (ignore the insert, put it in another table, or
delete an old row before inserting the new one). Why do you want to limit
the number of rows?

Sean

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Vanja 2005-12-28 16:35:07 Re: limiting number of allowed rows in a table
Previous Message Vanja 2005-12-28 14:53:59 limiting number of allowed rows in a table