pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: kasper <no@spam.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Trigger problem
Date: Wed, 9 Jun 2004 13:30:30 -0700 (PDT)
Message-ID: <20040609132740.F93111@megazone.bigpanda.com> (raw)
In-Reply-To: <BJnxc.1978$_s7.121@news.get2net.dk>
References: <BJnxc.1978$_s7.121@news.get2net.dk>


On Tue, 8 Jun 2004, kasper wrote:

> Im tryint to make a trigger that marks a tuble as changed whenever someone
> has updated it
>
> my table looks something like this
>
> create table myTable (
>     ...
>     changed boolean;
> )
>
> now ive been working on a trigger and a sp that looks like this, but it
> doesnt work...
>
> create function myFunction returns trigger as '
>     begin
>         new.changed = true;
>         return new;
>     end;
> ' language 'plpgsql';
>
> create trigger myTrigger
> after update on lektioner
> for each row
> execute procedure myFunction();

You want a before update trigger if you want to update the new row like
that.




view thread (10+ messages)  latest in thread

Message-ID: <20040609132740.F93111@megazone.bigpanda.com>
Permalink:  ../20040609132740.F93111@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20040609132740.F93111@megazone.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone.bigpanda.com, no@spam.com
  Subject: Re: Trigger problem
  In-Reply-To: <20040609132740.F93111@megazone.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox