| From: | Doug McNaught <doug(at)wireboard(dot)com> |
|---|---|
| To: | hs(at)cybertec(dot)at |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Passing parameters to triggers |
| Date: | 2002-03-20 16:45:49 |
| Message-ID: | m3adt3xk5e.fsf@varsoon.denali.to |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hans-Jürgen Schönig <hs(at)cybertec(dot)at> writes:
> I have a severe problem when working with PL/pgSQL triggers. Somehow the
> problem seems to be strange. Here is the code:
>
> CREATE OR REPLACE FUNCTION checkint () RETURNS opaque AS
> '
> BEGIN
> IF TG_OP = ''DELETE'' THEN
> RAISE NOTICE ''% wert'', TG_ARGV[0];
> DELETE FROM TG_ARGV[0];
You need to construct a query on the fly using EXECUTE, since queries
are preparsed in PL/pgSQL. So it would be:
EXECUTE ''DELETE FROM '' || TG_ARGV[0] ;
-Doug
--
Doug McNaught Wireboard Industries http://www.wireboard.com/
Custom software development, systems and network consulting.
Java PostgreSQL Enhydra Python Zope Perl Apache Linux BSD...
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Vincent Stoessel | 2002-03-20 17:00:39 | bug/feature with upper function? |
| Previous Message | Stephan Szabo | 2002-03-20 16:42:44 | Re: no quotes in arrays in 7.2 |