Using C functions with triggers

From: Kenny Carruthers <pgmail(at)kennyc(dot)com>
To: <pgsql-interfaces(at)postgresql(dot)org>
Subject: Using C functions with triggers
Date: 2002-05-06 07:53:47
Message-ID: B8FB849B.35EB%pgmail@kennyc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hi:

I have an application that uses libpq to communicate with a database.
>From inside my application, I would like to define a 'trigger' and specify a
function that is in my application as the 'trigger func' parameter. (This is
all in C) Is this even possible? If not, how would one go about setting up
such a callback system? What I want is to be able to define triggers at
runtime from my application, and have different functions get executed when
the trigger fires.

(Being new to PostgreSQL, triggers might not even be what I need. I am
attempting to create a sort of 'node monitoring' system whereby my client
application can request to be notified whenever an insert, update or delete
happens to a row that is part of a view.)

A concrete example would be: I have a table that contains a bunch of
contacts. I have a view setup to display all contacts that match a pattern.
I want to setup a trigger that tells me whenever my view is modified from
either an insert, update or delete. (If my trigger can't be isolated to a
view but only to a table, then I could live with that)

Thank you for any help you can offer.

Sincerely,
Kenny Carruthers
pgmail(at)kennyc(dot)com

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Lee Kindness 2002-05-06 10:24:36 Re: [INTERFACES] ECPG: FETCH ALL|n FROM cursor - Memory allocation?
Previous Message Christof Petig 2002-05-06 07:37:18 Re: [INTERFACES] ECPG: FETCH ALL|n FROM cursor - Memory allocation?