pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dirk Heinrichs <dirk.heinrichs@online.de>
To: pgsql-interfaces@postgresql.org
Subject: Re: plPerl: How to iterate over $_TD->{new} in a trigger function?
Date: Wed, 28 Jun 2006 20:15:38 +0200
Message-ID: <200606282015.39032.dirk.heinrichs@online.de> (raw)
In-Reply-To: <200606282000.43782.dirk.heinrichs@online.de>
References: <200606282000.43782.dirk.heinrichs@online.de>

Am Mittwoch, 28. Juni 2006 20:00 schrieb Dirk Heinrichs:

> I want to write a generic trigger function, which can be attached to any
> table, but it seems I'm to stupid :-) to get column/value pairs out of
> $_TD->{new} and $_TD->{old}.

OK, got it myself.

> create or replace function test_trig() returns trigger as $$
>         elog (INFO, "Table is: $_TD->{relname}\n");
>         my %newrow = %_TD->{new};
	my %newrow = %{$_TD->{new}};
>         elog (INFO, "$x=$y\n") while (($x,$y) = each %newrow);
>         return;
> $$ language plperl;

Works as expected.

Bye...

	Dirk

view thread (2+ messages)

Message-ID: <200606282015.39032.dirk.heinrichs@online.de>
Permalink:  ../200606282015.39032.dirk.heinrichs@online.de/
Also on:    postgresql.org/message-id/200606282015.39032.dirk.heinrichs@online.de

 · 

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-interfaces@postgresql.org
  Cc: dirk.heinrichs@online.de
  Subject: Re: plPerl: How to iterate over $_TD->{new} in a trigger function?
  In-Reply-To: <200606282015.39032.dirk.heinrichs@online.de>

* 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