pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gunter Diehl <gdid@gmx.de>
To: pgsql-sql@postgresql.org
Subject: Rules: passing new/old to functions
Date: Sun, 22 Jun 2003 22:28:12 +0200 (MEST)
Message-ID: <11362.1056313692@www59.gmx.net> (raw)

How to pass the special variables new / old to functions?

e.g. I'd like to to something like this (v is a view):

create funtion f1(v, v) returns void as '...'
create rule vupt as on update to v do instead select f1(new, old)

While accepting this definitions, pg says it can not handle "whole-tuple
references" at runtime.

using: select f(new) from new    doesn't work either: pg says relation new
doesn't exist.

Since I need to handle tables with more than 20 columns, it would be uggly
if I had to pass every single value to the function as follows:
select f1(new.1, ..., new.n, old.1, ..., old.n)
create function f1(typeof 1, ..., typeof n, typeof 1, ..., typeofn)


I'd be glad for any kind of suggestion.

regards,
	Gunter


-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!




view thread (2+ messages)  latest in thread

Message-ID: <11362.1056313692@www59.gmx.net>
Permalink:  ../11362.1056313692@www59.gmx.net/
Also on:    postgresql.org/message-id/11362.1056313692@www59.gmx.net

 · 

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: gdid@gmx.de
  Subject: Re: Rules: passing new/old to functions
  In-Reply-To: <11362.1056313692@www59.gmx.net>

* 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