Re: Pl/Pgsql triger procedure calls with parameters

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David A Dickson <david(dot)dickson(at)mail(dot)mcgill(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Pl/Pgsql triger procedure calls with parameters
Date: 2001-11-26 23:49:59
Message-ID: 16117.1006818599@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

David A Dickson <davidd(at)saraswati(dot)wcg(dot)mcgill(dot)ca> writes:
> I am trying to make a call to a function that takes three text parameters
> as input from a trigger. The function is supposed to check if
> SELECT * FROM $3 WHERE new.$1 = $3.$2
> has more than 0 rows.

While this may seem neat and clean, I think you'd be a lot better off
writing multiple trigger functions that have the table and field names
wired into them. If you insist on parameterizing like this, you will
have to run the queries via EXECUTE in plpgsql, which means you will get
no query plan caching, which is a performance hit you probably do not
want to take in a trigger function.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gurupartap Davis 2001-11-27 00:06:19 Re: Optimize for insertions?
Previous Message news.postgresql.org 2001-11-26 23:36:28 check constriaint for BLOB