Re: Passing parameters to triggers
| От | Doug McNaught |
|---|---|
| Тема | Re: Passing parameters to triggers |
| Дата | |
| Msg-id | m3adt3xk5e.fsf@varsoon.denali.to обсуждение исходный текст |
| Ответ на | Passing parameters to triggers (Hans-Jürgen Schönig <hs@cybertec.at>) |
| Список | pgsql-general |
Hans-Jürgen Schönig <hs@cybertec.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...
В списке pgsql-general по дате отправления: