ERROR: fmgr_info: function 0: cache lookup failed

Started by Mourad EL HADJ MIMOUNEalmost 25 years ago3 messagesgeneral
Jump to latest
#1Mourad EL HADJ MIMOUNE
mimoune@ensma.fr

Hi,
I want retrieve ROW of tables by their OID,
to do thise I made as folowing :
CREATE TABLE tab1 (X int4, Y varchar);
CREATE

CREATE FUNCTION tabrecord (OID) returns RECORD AS 'BEGIN RETURN(SELECT *
FROM tab1 WHERE OID = $1) END;' language 'plpgsql';
NOTICE: ProcedureCreate: type 'record' is not yet defined
NOTICE: ProcedureCreate: type 'record' is not yet defined
CREATE

select tabrecord (2542 :: oid);
ERROR: fmgr_info: function 0: cache lookup failed
ERROR: fmgr_info: function 0: cache lookup failed

could you help me to solve this problem please,
Mourad.

#2Alex Pilosov
alex@pilosoft.com
In reply to: Mourad EL HADJ MIMOUNE (#1)
Re: ERROR: fmgr_info: function 0: cache lookup failed

Currently, you must do:

CREATE FUNCTION tabrecord (OID) returns tab1 AS '...

But it wouldn't help you much since the only thing you can do with this
function is:

select x(tabrecord(2542)),y(tabrecord(2542))

On Wed, 4 Jul 2001, Mourad EL HADJ MIMOUNE wrote:

Show quoted text

Hi,
I want retrieve ROW of tables by their OID,
to do thise I made as folowing :
CREATE TABLE tab1 (X int4, Y varchar);
CREATE

CREATE FUNCTION tabrecord (OID) returns RECORD AS 'BEGIN RETURN(SELECT *
FROM tab1 WHERE OID = $1) END;' language 'plpgsql';
NOTICE: ProcedureCreate: type 'record' is not yet defined
NOTICE: ProcedureCreate: type 'record' is not yet defined
CREATE

select tabrecord (2542 :: oid);
ERROR: fmgr_info: function 0: cache lookup failed
ERROR: fmgr_info: function 0: cache lookup failed

could you help me to solve this problem please,
Mourad.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alex Pilosov (#2)
Re: ERROR: fmgr_info: function 0: cache lookup failed

Alex Pilosov <alex@pilosoft.com> writes:

Currently, you must do:
CREATE FUNCTION tabrecord (OID) returns tab1 AS '...

Right, "returns record" is bogus. The reason for the peculiar
error message seems to be that plpgsql is sloppy about checking
pg_type.typisdefined before believing that it has a valid type name.
I suspect this oversight is widespread :-(

regards, tom lane