Обсуждение: Calling triggers with arguments
Greetings,
I've come across something that either doesn't work spec'd or I'm
missing something (I suspect the latter). I'm trying this:
CREATE TRIGGER classified_index_trigger
BEFORE INSERT OR UPDATE ON ads
FOR EACH ROW
EXECUTE PROCEDURE htdig_index('classified_en');
and the error message I get is:
ERROR: function htdig_index() does not exist
However if I do \df htdig_index I get this:
List of functions
Result data type | Schema | Name | Argument data types
------------------+--------+-------------+---------------------
"trigger" | public | htdig_index | text
Is there something I'm missing in order to pass an argument in a
trigger? I've tried double quotes, and two singles as well as no
quotes, and all lead to the same thing.
Any info would be much appreciated.
Cheers,
Chris
--
Christopher Murtagh
Enterprise Systems Administrator
ISR / Web Communications Group
McGill University
Montreal, Quebec
Canada
Tel.: (514) 398-3122
Fax: (514) 398-2017
Christopher Murtagh <christopher.murtagh@mcgill.ca> writes: > Greetings, > > I've come across something that either doesn't work spec'd or I'm > missing something (I suspect the latter). I'm trying this: Read the docs again. Args aren't passed to triggers through the normal mechanism but via a special variable. -Doug
On Fri, 2004-01-23 at 17:42, Doug McNaught wrote: > Christopher Murtagh <christopher.murtagh@mcgill.ca> writes: > > > Greetings, > > > > I've come across something that either doesn't work spec'd or I'm > > missing something (I suspect the latter). I'm trying this: > > Read the docs again. Args aren't passed to triggers through the > normal mechanism but via a special variable. Thanks for the info. I finally found it (TG_ARGV[]). It certainly isn't in an obvious place, and not clearly documented, but it was there. Cheers, Chris -- Christopher Murtagh Enterprise Systems Administrator ISR / Web Communications Group McGill University Montreal, Quebec Canada Tel.: (514) 398-3122 Fax: (514) 398-2017
There wasn't much help online when I decided this had to be a concept that would work. Sybase is not a lot of help on this either. After sometimes spending hours staring at traces and explains in order to solve a single problem (and often using a totally heuristic approach to debugging :-)), I finally have real world applications running (very well in fact). In order to document the details for myself, and to share them with others, I've setup a small website. It's a little rough and incomplete so far, but hopefully it will be useful to someone. The address is: http://pbpgsql.spiderbark.com Best regards, Jim Wilson