Trigger Tangent (Was: bind (Was: sequences ))

From: Clark Evans <clark(dot)evans(at)manhattanproject(dot)com>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Trigger Tangent (Was: bind (Was: sequences ))
Date: 1999-03-19 05:20:41
Message-ID: 36F1DEA9.B352B162@manhattanproject.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Caution: Random Thoughts & Trigger Tangent

This whole discussion got me to thinking about triggers.
Are we making, in this case, a specialized trigger that
populates a table column from a sequence on insert?
Perhaps it may be instructive to look at the
general case for enlightenment.

Aside, I really don't like Oracle's trigger concept:
"CREATE TRIGGER xxx ON INSERT OF tablename AS"

I'd rather see the trigger object as a stand alone
block of code that is "bound" to one or more tables.
Thus, the above, would be a short hand for:

"CREATE TRIGGER xxx AS .... ; BIND xxx TO tablename ON INSERT;"

Now.. if you wanted to _way_ generalize this...
You can think of "INSERT/UPDATE/DELETE" as mutating actions
taken on a table object. What mutating actions does a
sequence object have? NEXTVAL

So... perhaps the trigger concept could be extended
past tables but onto any object that has mutating actions?
(you have to excuse the lack of rule system knowledge here)

And... if you want go further into the muck, perhaps
we could have triggers that have a binding with more
than one object..

> FUNCTION bind( TABLE, COLUMN, SEQUENCE ) RETURNS OLD_SEQUENCE;

Becomes,

FUNCTION bind( SEQUENCE_TRIGGER, TABLE, COLUMN, SEQUENCE )
RETURNS OLD_SEQUENCE;

Hmm. Oh well I thought I was going somewhere.... better
re-name this a tangent.

:) Clark

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Meskes 1999-03-19 07:54:57 CVS target for docs
Previous Message Clark Evans 1999-03-19 04:36:44 FUNCTION bind (TABLE, COLUMN, SEQUENCE) returns OLD_SEQUENCE? (Was: Re: [HACKERS] Sequences....)