X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4949DD1B2A6 for ; Wed, 9 Jun 2004 06:01:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68112-10 for ; Wed, 9 Jun 2004 09:01:46 +0000 (GMT) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by svr1.postgresql.org (Postfix) with ESMTP id 7084AD1B20D for ; Wed, 9 Jun 2004 06:01:43 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-34.mail.demon.net with esmtp (Exim 3.35 #1) id 1BXyxr-00098r-0Y; Wed, 09 Jun 2004 10:01:44 +0100 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 7028216239; Wed, 9 Jun 2004 10:01:43 +0100 (BST) Message-ID: <40C6D1FA.4010907@archonet.com> Date: Wed, 09 Jun 2004 10:01:46 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 0.6 (X11/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: phil@cobol-africa.com Cc: pgsql-sql@postgresql.org Subject: Re: Triggers References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/70 X-Sequence-Number: 18015 Philip J. Boonzaaier wrote: > The technical reference gives an example of a trigger on a table - employee > Just to test this, I have created the following table, > CREATE TABLE employee > (name VARCHAR(30), > age int4, > state VARCHAR(2), > manager VARCHAR(3), > adult VARCHAR(3)); > > The I created a simple Function, as follows : > > CREATE FUNCTION trig_insert_update_check_emp() RETURNS opaque AS ' The "opaque" type has been split into several different ones, if you're using a recent version of PG, you'll want "RETURNS trigger". [snip] > Now, when I execute the following : > > INSERT INTO employee (name,age,state,manager) > VALUES ('sean',29,'tx','yes'); > > I get : > > ERROR fmgr_info function 6264440 cache lookup failed This usually means you redefined something - PG isn't smart enough (yet) to re-check all the dependencies in something like this. I'd guess you dropped/recreated the function after defining the trigger, yes? The solution in older versions is to put the CREATE FUNCTION and CREATE TRIGGER in the same file so that you drop/recreate both together. HTH -- Richard Huxton Archonet Ltd