Thread: fmgr_info: function 0: cache lookup failed
I'm porting an Access database to Postgres but keeping Access as the client. I have been having problems with checkboxes and so I did some searching and came across information that told me to uncheck Bools as Char in the ODBC driver settings, I did that and started getting the following error: ERROR: Unable to identify an operator '=' for types 'boolean' and 'integer' You will have to retype this query using an explicit cast So after some more searching I came across a message talking about adding the function and an operator below to handle this problem: CREATE FUNCTION MsAccessBool (bool, int4) RETURNS BOOL AS ' BEGIN IF $1 IS NULL THEN RETURN NULL; END IF; IF $1 IS TRUE THEN IF $2 <> 0 THEN RETURN TRUE; END IF; ELSE IF $2 = 0 THEN RETURN TRUE; END IF END IF; RETURN FALSE; END ; ' LANGUAGE 'plpgsql'; CREATE OPERATOR = ( LEFTARG = BOOL, RIGHTARG = INT4, PROCEDURE = MsAccessBool, COMMUTATOR = '=', NEGATOR = '<>', RESTRICT = EQSEL, JOIN = EQJOINSEL); So I did this, and now I'm getting the "fmgr_info: function 0: cache lookup failed" message. I've again done some looking and the only thing I've found is a message that talks about the oprrest and oprjoin fields in the pg_operator table, but not what I need to do with them. Any help would be greatly appreciated. Thanks, Rob
"Booth, Robert" <Robert_Booth@intuit.com> writes: > CREATE FUNCTION MsAccessBool (bool, int4) RETURNS BOOL AS ... > CREATE OPERATOR = ( > LEFTARG = BOOL, > RIGHTARG = INT4, > PROCEDURE = MsAccessBool, > COMMUTATOR = '=', > NEGATOR = '<>', > RESTRICT = EQSEL, > JOIN = EQJOINSEL); > So I did this, and now I'm getting the "fmgr_info: function 0: cache lookup > failed" message. You are telling the system that there will be an int4 = bool operator (the commutator) as well as a bool <> int4 operator (the negator). If you are not going to supply same, don't declare that you will. The error message could be more helpful, perhaps :-( regards, tom lane
--- "Booth, Robert" <Robert_Booth@intuit.com> wrote: > I'm porting an Access database to Postgres but > keeping Access as the client.... > ...So I did this, and now I'm getting the "fmgr_info: > function 0: cache lookup > failed" message. ...Any help would be > greatly appreciated. > > Thanks, > Rob Your problem, as I see, could be fixed following the instructions bellow: http://techdocs.postgresql.org/errors.php#plpgsqlinit_fcache Juliano S. Ignacio jsignacio@yahoo.com __________________________________________________ Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/
"Booth, Robert" <Robert_Booth@intuit.com> writes: >> CREATE FUNCTION MsAccessBool (bool, int4) RETURNS BOOL AS ... >> CREATE OPERATOR = ( >> LEFTARG = BOOL, >> RIGHTARG = INT4, >> PROCEDURE = MsAccessBool, >> COMMUTATOR = '=', >> NEGATOR = '<>', >> RESTRICT = EQSEL, >> JOIN = EQJOINSEL); > So I did this, and now I'm getting the "fmgr_info: function 0: cache lookup > failed" message. > You are telling the system that there will be an int4 = bool operator > (the commutator) as well as a bool <> int4 operator (the negator). > If you are not going to supply same, don't declare that you will. > The error message could be more helpful, perhaps :-( > regards, tom lane So are you telling me that I need to create another OPERATOR? And if so would this be the correct syntax? CREATE OPERATOR <> ( LEFTARG = BOOL, RIGHTARG = INT4, PROCEDURE = MsAccessBool, COMMUTATOR = '=', NEGATOR = '<>', RESTRICT = EQSEL, JOIN = EQJOINSEL); Rob