Sequences, triggers and 'OLD' - am I being stupid?

From: "Steve South" <steve(dot)south(at)blueyonder(dot)co(dot)uk>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Sequences, triggers and 'OLD' - am I being stupid?
Date: 2005-10-07 12:59:40
Message-ID: 001a01c5cb3e$faa49c70$6401a8c0@GROCER
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I'll admit straight away I'm a novice, but this one has me perplexed....

I have a table, T1, with a column (userid) that is an int4 generated from a
sequence.

I have a second table (T2) that I wish to use to hold audited values from
T1.

I have created a trigger function written in PL/PGSQL, set to be for each
row after update on T2, which is supposed to copy the OLD values into T2.

The snag is that when I try to update a row in T1 I get:

ERROR: record "old" has no field "userid"

This behaviour does not seem to be documented anywhere. Am I just being
dense?

TIA,

Steve S

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.13/123 - Release Date: 06/10/2005

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Terry Lee Tucker 2005-10-07 13:19:24 Re: Sequences, triggers and 'OLD' - am I being stupid?
Previous Message Oliver Elphick 2005-10-07 11:58:20 Re: TEMPORARY TABLE in a PL/pgSQL function