Skip site navigation (1) Skip section navigation (2)

Re: Generalized trigger function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Gang Cheng" <cg1101(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Generalized trigger function
Date: 2006-06-17 16:16:59
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
"Gang Cheng" <cg1101(at)gmail(dot)com> writes:
> I'm trying to implement a generalized trigger function that can take as
> arguments the names of columns to be updated with username and timestamp of
> the INSERT/UPDATE event.

This is not possible in plpgsql, primarily because it's a strongly-typed
language and wants to know the datatypes of everything in advance.
You could do it in C for sure, and probably in some of the other PLs
that don't care about datatypes because they convert everything to
strings anyway.  If this trigger is something you intend to apply to all
your tables, for performance reasons you might want to bite the bullet
and do it in C.  There are some examples that do nearly this in

			regards, tom lane

In response to

pgsql-novice by date

Next:From: Tom LaneDate: 2006-06-17 16:44:49
Subject: Re: cannot access directory /pg_tblspc/*
Previous:From: Gang ChengDate: 2006-06-17 13:08:54
Subject: Generalized trigger function

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group