Re: Any plans on allowing user-defined triggers to be

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Mike Mascari <mascarm(at)mascari(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Any plans on allowing user-defined triggers to be
Date: 2004-10-26 14:17:12
Message-ID: 20041026071506.S92214@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Tue, 26 Oct 2004, Mike Mascari wrote:

> I'd like to ensure that the creation of a department also implies the
> creation of two to eight projects; no more, no less:
>
> CREATE TABLE departments (
> department text primary key not null
> );
>
> CREATE TABLE projects (
> project text primary key not null,
> department text not null
> references departments(department)
> on delete cascade
> on update cascade
> );
>
> So it'd be nice to have an INSERT trigger that's fired on departments at
> the end of the transaction to ensure that between two and eight projects
> exist for the newly created department.
>
> Is there no way to achieve the above stated goal in the server? Must I
> rely on the application to enforce consistency?

Well. It's not exactly meant to be a user facing feature, but check out
CREATE CONSTRAINT TRIGGER.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2004-10-26 14:24:41 Re: Bug or stupidity
Previous Message Tino Wildenhain 2004-10-26 13:38:07 Re: Strange count(*) implementation?