Re: Triggers

From: Richard Huxton <dev(at)archonet(dot)com>
To: phil(at)cobol-africa(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Triggers
Date: 2004-06-09 09:01:46
Message-ID: 40C6D1FA.4010907@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

  • Triggers at 2004-02-26 10:18:57 from Philip J. Boonzaaier

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Gamache 2004-06-09 16:41:03 Schema + User-Defined Data Type Indexing problems...
Previous Message Richard Huxton 2004-06-09 08:58:40 Re: returning a recordset from PLpg/SQL