Skip site navigation (1) Skip section navigation (2)

Re: Trigger set to backup to other table NOT FUNCTIONING...

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Joepie Platteau <Joepie(dot)Platteau(at)kulak(dot)ac(dot)be>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Trigger set to backup to other table NOT FUNCTIONING...
Date: 2004-09-14 05:00:45
Message-ID: 1095138045.21855.44.camel@linda (view raw or flat)
Thread:
Lists: pgsql-admin
On Mon, 2004-09-13 at 11:05, Joepie Platteau wrote:
> Hi,
> I have a problem with my trigger... :
> 
> my tables :
> 
> CREATE TABLE public."T-Alumni" (
> "Id_Persoon" int8 DEFAULT nextval('"T-Alumni_Id_Persoon_seq"'::text) NOT 
  ^^^^^^^^^^^^
> NULL,
...
> CREATE FUNCTION public.f100() RETURNS trigger AS '
> BEGIN
> INSERT INTO "T-Alumni-backup" VALUES (NEW.Id_Persoon, NEW.SteunendLid,
                                            ^^^^^^^^^^
...
> 
> I get this error :
> Record "new" has no field "id_persoon" (#7)

You created it with the column names double quoted so they are really
mixed case.  However, you are accessing it without the double quotes, so
that the name is folded to lower case.  Therefore the names don't match.

> Also I want to have the name of the person who deleted or changed the 
> record in my BackUp (undo) table...

CURRENT_USER will give you the user id; if that's what you mean.

-- 
Oliver Elphick                                          olly(at)lfix(dot)co(dot)uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
     "But without faith it is impossible to please him; for 
      he that cometh to God must believe that he is, and 
      that he is a rewarder of them that diligently seek 
      him."        Hebrews 11:6 


In response to

Responses

pgsql-admin by date

Next:From: Tom LaneDate: 2004-09-14 06:17:37
Subject: Re: pg_class / missing tables
Previous:From: Chester KustarzDate: 2004-09-14 04:40:28
Subject: Re: pg_class / missing tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group