From: | Juan Jose Costello Levien <jcostello(at)datafull(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Row values |
Date: | 2004-07-02 10:36:50 |
Message-ID: | 40E53AC2.6090308@datafull.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
I am writing my first trigger in C for PostgreSQL. It compiles Ok, and
added it to the database using CREATE TRIGGER. But when I try to fire
it, psql simply says 'The connection was lost". What I don't know is how
to get the row values (not the name fields) from tg_trigger.
The code is:
...
TriggerData *trigdata = (TriggerData *) fcinfo->context;
...
strcpy(query, "INSERT INTO visita_log VALUES ('");
strcat(query, trigdata->tg_trigger->tgargs[0]);
strcat(query, "','");
strcat(query, trigdata->tg_trigger->tgargs[1]);
strcat(query, "','");
strcat(query, trigdata->tg_trigger->tgargs[2]);
strcat(query, "','");
strcat(query, trigdata->tg_trigger->tgargs[3]);
strcat(query, "',");
strcat(query, trigdata->tg_trigger->tgargs[4]);
strcat(query, ",'");
strcat(query, trigdata->tg_trigger->tgargs[5]);
strcat(query, "');");
SPI_exec(query, 0);
...
I don't know if tgargs[] return the row values or the field names.
Thanks.
Juan
From | Date | Subject | |
---|---|---|---|
Next Message | Andy B | 2004-07-02 11:51:14 | Re: postgresql +AMD64 +big address spaces - does it work? |
Previous Message | Shridhar Daithankar | 2004-07-02 09:03:38 | Re: Enough RAM for entire Database.. cost aside, is this |