dynamically access columns in trigger - Mailing list pgsql-general

From Daniel Schuchardt
Subject dynamically access columns in trigger
Date
Msg-id hrrkfs$1o1j$1@news.hub.org
Whole thread Raw
List pgsql-general
Hy,

i need to have some idea how to dynamically access columns in a trigger.

Use/Case:

We have a workflowmodule. In different cases different workflows should
be fired. In the Workflowdefinitiontable, we say "tablename, when". so e.g.
~~table 1 -> insert~~
~~table 2 -> update~~.

We have a central trigger that fires on all tables. Inside the trigger i
evaluate with "TG_REL_NAME=wf_tablename" -> start workflow.

Now the problem is that there are different workflows in the update
case. e.g. if the price changes, a "CheckNewPrice" workflow is startet,
if a date changes a "CheckNewDeliveryDate" workflow is started.

My idea is to give my workflowdefinitiontable a additional column the
holds the condition, e.g.
~~table 2 -> update -> ~~~~~ new.pricecolumn<>old.pricecolumn ~~~
so i need a solution how to evaluate that dynamic statement in my global
trigger funktion.

Any ideas?

--

Daniel Schuchardt
/Softwareentwicklung/

/http://www.prodat-sql.de/


pgsql-general by date:

Previous
From: pasman pasmański
Date:
Subject: Multilevel partitioning
Next
From: Amol Chiplunkar
Date:
Subject: Table alias and inherited tables