pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Cache Lookup failed Error - while using Triggers
4+ messages / 2 participants
[nested] [flat]

* Cache Lookup failed Error - while using Triggers
@ 2002-09-11 04:44 shreedhar <shreedhar@lucidindia.net>
  2002-09-11 05:08 ` Re: Cache Lookup failed Error - while using Triggers Joe Conway <mail@joeconway.com>
  0 siblings, 1 reply; 4+ messages in thread

From: shreedhar @ 2002-09-11 04:44 UTC (permalink / raw)
  To: pgsql-admin

Hi All,

I took the following example to create trigger

TABLE

CREATE TABLE emp (
    empname text,
    salary integer,
    last_date timestamp,
    last_user text);




Function emp_stamp() returns OPAQUE

DECLARE
current_user text;
    BEGIN
        -- Check that empname and salary are given
        IF NEW.empname ISNULL THEN
            RAISE EXCEPTION ''empname cannot be NULL value'';
        END IF;
        IF NEW.salary ISNULL THEN
            RAISE EXCEPTION ''% cannot have NULL salary'', NEW.empname;
        ELSE
            current_user := NEW.empname;
        END IF
        -- Who works for us when she must pay for?
        IF NEW.salary < 0 THEN
            RAISE EXCEPTION ''% cannot have a negative salary'',
NEW.empname;
        END IF;
        -- Remember who changed the payroll when
        NEW.last_date := ''now'';
        NEW.last_user := NEW.empname;
        RETURN NEW;
    END;

Trigger

CREATE TRIGGER emp_stamp BEFORE INSERT OR UPDATE ON emp
    FOR EACH ROW EXECUTE PROCEDURE emp_stamp();

If I use the following INSERT Statement

INSERT INTO  emp (empname,salary, last_date, last_user) VALUES ('sree',1000,
'2002-09-11','sreedhar');

I am getting the following Error

'ERROR : fmgr_info : function 1059155 : cahce lookup failed
PostgreSQL status : PGRES_FATAL_ERROR'

Can any body tell that what is this error. How can I solve this.


With Best Regards,
Sreedhar Bhaskararaju 1,2nd Main Road, KottuGardens, Chennai - 600 085 Ph :
4475111 Email : shreedhar@lucidindia.net




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Cache Lookup failed Error - while using Triggers
  2002-09-11 04:44 Cache Lookup failed Error - while using Triggers shreedhar <shreedhar@lucidindia.net>
@ 2002-09-11 05:08 ` Joe Conway <mail@joeconway.com>
  2002-09-11 06:06   ` Re: Cache Lookup failed Error - while using Triggers shreedhar <shreedhar@lucidindia.net>
  0 siblings, 1 reply; 4+ messages in thread

From: Joe Conway @ 2002-09-11 05:08 UTC (permalink / raw)
  To: shreedhar <shreedhar@lucidindia.net>; +Cc: pgsql-admin

shreedhar wrote:
> I am getting the following Error
> 
> 'ERROR : fmgr_info : function 1059155 : cahce lookup failed
> PostgreSQL status : PGRES_FATAL_ERROR'
> 
> Can any body tell that what is this error. How can I solve this.
> 

If you drop and recreate the function, you need to also drop and recreate the 
trigger. Did you do the former without the latter?

Joe




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Cache Lookup failed Error - while using Triggers
  2002-09-11 04:44 Cache Lookup failed Error - while using Triggers shreedhar <shreedhar@lucidindia.net>
  2002-09-11 05:08 ` Re: Cache Lookup failed Error - while using Triggers Joe Conway <mail@joeconway.com>
@ 2002-09-11 06:06   ` shreedhar <shreedhar@lucidindia.net>
  2002-09-13 03:51     ` Re: Cache Lookup failed Error - while using Triggers Joe Conway <mail@joeconway.com>
  0 siblings, 1 reply; 4+ messages in thread

From: shreedhar @ 2002-09-11 06:06 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; +Cc: pgsql-admin

Hi Joe,

Thanks Alot,

I followed how u said, then if I execute the same insert statement the
following error is occuring.

ERROR : Parse error at or near "empname"

As I Check I didnot find any parse error there. This is error is occuring if
and only if 'emp' table have trigger. Is there any problem in function
'aa_emp_stamp()'

Regards,
Sreedhar
----- Original Message -----
From: "Joe Conway" <mail@joeconway.com>
To: "shreedhar" <shreedhar@lucidindia.net>
Cc: "Postgres" <pgsql-admin@postgresql.org>
Sent: Wednesday, September 11, 2002 10:38 AM
Subject: Re: [ADMIN] Cache Lookup failed Error - while using Triggers


> shreedhar wrote:
> > I am getting the following Error
> >
> > 'ERROR : fmgr_info : function 1059155 : cahce lookup failed
> > PostgreSQL status : PGRES_FATAL_ERROR'
> >
> > Can any body tell that what is this error. How can I solve this.
> >
>
> If you drop and recreate the function, you need to also drop and recreate
the
> trigger. Did you do the former without the latter?
>
> Joe




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Cache Lookup failed Error - while using Triggers
  2002-09-11 04:44 Cache Lookup failed Error - while using Triggers shreedhar <shreedhar@lucidindia.net>
  2002-09-11 05:08 ` Re: Cache Lookup failed Error - while using Triggers Joe Conway <mail@joeconway.com>
  2002-09-11 06:06   ` Re: Cache Lookup failed Error - while using Triggers shreedhar <shreedhar@lucidindia.net>
@ 2002-09-13 03:51     ` Joe Conway <mail@joeconway.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Joe Conway @ 2002-09-13 03:51 UTC (permalink / raw)
  To: shreedhar <shreedhar@lucidindia.net>; +Cc: pgsql-admin

shreedhar wrote:
> Hi Joe,
> 
> Thanks Alot,
> 
> I followed how u said, then if I execute the same insert statement the
> following error is occuring.
> 
> ERROR : Parse error at or near "empname"
> 
> As I Check I didnot find any parse error there. This is error is occuring if
> and only if 'emp' table have trigger. Is there any problem in function
> 'aa_emp_stamp()'

I don't know what aa_emp_stamp() looks like. The function you sent in the 
other day was called emp_stamp() -- is that the same? If so, you were missing 
as ";":

DECLARE
     current_user text;
BEGIN
     -- Check that empname and salary are given
     IF NEW.empname ISNULL THEN
        RAISE EXCEPTION ''empname cannot be NULL value'';
     END IF;
     IF NEW.salary ISNULL THEN
        RAISE EXCEPTION ''% cannot have NULL salary'', NEW.empname;
     ELSE
        current_user := NEW.empname;
     END IF
          ^^^^
          missing a ;


Joe




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2002-09-13 03:51 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-09-11 04:44 Cache Lookup failed Error - while using Triggers shreedhar <shreedhar@lucidindia.net>
2002-09-11 05:08 ` Joe Conway <mail@joeconway.com>
2002-09-11 06:06   ` shreedhar <shreedhar@lucidindia.net>
2002-09-13 03:51     ` Joe Conway <mail@joeconway.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox