Trigger programming..

From: "Mitch Vincent" <mitch(at)venux(dot)net>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Trigger programming..
Date: 2000-06-30 20:45:16
Message-ID: 019201bfe2d4$1af262e0$0300000a@doot.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a function written in C, a trigger calls this function on the table
applicants. I need to get the value from a field named "app_id" in the table
that the trigger is pulled on (applicants)..

I have this code...

app_id_fieldname is a character pointer with value "app_id". char_app_id is
always NULL though.. I'm totally guessing at most of this from looking
through some examples and the SPI section of the programmer's manual.

Someone school me -- please! :-)

tupdesc = rel->rd_att; /* what the tuple looks like (?) */

app_id_colnum = SPI_fnumber(tupdesc, app_id_fieldname);

if (app_id_colnum == SPI_ERROR_NOATTRIBUTE)
elog(ERROR, "app_id_colnum - SPI_ERROR_NOATTRIBUTE error ");

char_app_id = SPI_getvalue(rettuple, tupdesc, app_id_colnum);

Thanks!!

-Mitch

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Wolfe 2000-06-30 21:49:32 Performance of Postgres via network connections
Previous Message Ron Peterson 2000-06-30 19:25:13 Re: Large Tables(>1 Gb)