Row values - Mailing list pgsql-general

From Juan Jose Costello Levien
Subject Row values
Date
Msg-id 40E53AC2.6090308@datafull.com
Whole thread Raw
Responses Re: Row values  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Re: Row values  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-general by date:

Previous
From: Stephen Liu
Date:
Subject: How to add an userA to login postgresadmin
Next
From: "Lee Harr"
Date:
Subject: Re: 7.4 serial not working ?