Re: NEW in after insert trugger contained incorrect data

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "brilliantov(at)byterg(dot)ru" <brilliantov(at)byterg(dot)ru>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: NEW in after insert trugger contained incorrect data
Date: 2014-11-14 10:28:16
Message-ID: A737B7A37273E048B164557ADEF4A58B17D9E49D@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Brilliantov Kirill Vladimirovich wrote:
> I use Postgre-9.3.5 on windows7 x64.
> I use simple trigger for store some statistic data, it code:
> SELECT field IN variable FROM table WHERE ...;
> IF FOUND THEN
> UPDATE table SET field = ...;
> ELSE
> INSERT INTO table (field) VALUES(value);
> END IF;
> RETURN NULL;
>
> This trigger added as FOR EACH ROW on table2.
> In table2 I insert multiple data on one insert, e.g. INSERT INTO
> table2(field) VALUES(value0),(value1),(value2).
>
> Unfortunately trigger exit with error: ERROR: record "new" has no field
> "value";

You should post the table definition and the whole trigger; the error
message seems to refer to things you omitted in your quote.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brilliantov Kirill Vladimirovich 2014-11-14 10:54:40 Re: NEW in after insert trugger contained incorrect data
Previous Message Albe Laurenz 2014-11-14 10:24:16 Re: Two instances of Postgres with single data directory