Cache lookup failed - Mailing list pgsql-hackers

From D'Arcy" "J.M." Cain
Subject Cache lookup failed
Date
Msg-id m10kfPU-0000bIC@druid.net
Whole thread Raw
List pgsql-hackers
I have created a new type and by struggling with the instructions at
http://www.postgresql.org/docs/programmer/xindex.htm (I'm preparing some
corrections) I di everything that I can to set this up fully.  I am able
to create a table using my type as the primary key and insert data into
it fine.  However, when I try to update or select using a WHERE clause I
get the following.

ERROR:  fmgr_info: function 0: cache lookup failed

Here is the SQL to create the type.  Any ideas?

--
--    PostgreSQL code for GLACCOUNTs.
--
--    $Id$
--

load '/usr/local/pgsql/modules/glaccount.so';

--
--    Input and output functions and the type itself:
--

create function glaccount_in(opaque)returns opaqueas '/usr/local/pgsql/modules/glaccount.so'language 'c';

create function glaccount_out(opaque)returns opaqueas '/usr/local/pgsql/modules/glaccount.so'language 'c';

create type glaccount (internallength = 16,externallength = 13,input = glaccount_in,output = glaccount_out
);

--
--  Some extra functions
--

create function glaccount_major(glaccount)returns intas '/usr/local/pgsql/modules/glaccount.so'language 'c';

create function glaccount_minor(glaccount)returns intas '/usr/local/pgsql/modules/glaccount.so'language 'c';

create function glaccount_cmp(glaccount, glaccount)returns intas '/usr/local/pgsql/modules/glaccount.so'language 'c';

--
--    The various boolean tests:
--

create function glaccount_eq(glaccount, glaccount)returns boolas '/usr/local/pgsql/modules/glaccount.so'language 'c';

create function glaccount_ne(glaccount, glaccount)returns boolas '/usr/local/pgsql/modules/glaccount.so'language 'c';

create function glaccount_lt(glaccount, glaccount)returns boolas '/usr/local/pgsql/modules/glaccount.so'language 'c';

create function glaccount_gt(glaccount, glaccount)returns boolas '/usr/local/pgsql/modules/glaccount.so'language 'c';

create function glaccount_le(glaccount, glaccount)returns boolas '/usr/local/pgsql/modules/glaccount.so'language 'c';

create function glaccount_ge(glaccount, glaccount)returns boolas '/usr/local/pgsql/modules/glaccount.so'language 'c';

--
--    Now the operators.  Note how some of the parameters to some
--    of the 'create operator' commands are commented out.  This
--    is because they reference as yet undefined operators, and
--    will be implicitly defined when those are, further down.
--

create operator < (leftarg = glaccount,rightarg = glaccount,
--    negator = >=,procedure = glaccount_lt
);

create operator <= (leftarg = glaccount,rightarg = glaccount,
--    negator = >,procedure = glaccount_le
);

create operator = (leftarg = glaccount,rightarg = glaccount,commutator = =,
--    negator = <>,procedure = glaccount_eq
);

create operator >= (leftarg = glaccount,rightarg = glaccount,negator = <,procedure = glaccount_ge
);

create operator > (leftarg = glaccount,rightarg = glaccount,negator = <=,procedure = glaccount_gt
);

create operator <> (leftarg = glaccount,rightarg = glaccount,negator = =,procedure = glaccount_ne
);

-- Now, let's see if we can set it up for indexing

INSERT INTO pg_opclass (opcname, opcdeftype) SELECT 'glaccount_ops', oid FROM pg_type WHERE typname = 'glaccount';

SELECT o.oid AS opoid, o.oprnameINTO TEMP TABLE glaccount_ops_tmpFROM pg_operator o, pg_type tWHERE o.oprleft = t.oid
AND   o.oprright = t.oid AND    t.typname = 'glaccount';
 

INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy,        amopselect, amopnpages)SELECT am.oid, opcl.oid,
c.opoid,1,        'btreesel'::regproc, 'btreenpage'::regprocFROM pg_am am, pg_opclass opcl, glaccount_ops_tmp cWHERE
amname= 'btree' AND    opcname = 'glaccount_ops' AND    c.oprname = '<';
 

INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy,        amopselect, amopnpages)SELECT am.oid, opcl.oid,
c.opoid,2,        'btreesel'::regproc, 'btreenpage'::regprocFROM pg_am am, pg_opclass opcl, glaccount_ops_tmp cWHERE
amname= 'btree' AND    opcname = 'glaccount_ops' AND    c.oprname = '<=';
 

INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy,        amopselect, amopnpages)SELECT am.oid, opcl.oid,
c.opoid,3,        'btreesel'::regproc, 'btreenpage'::regprocFROM pg_am am, pg_opclass opcl, glaccount_ops_tmp cWHERE
amname= 'btree' AND    opcname = 'glaccount_ops' AND    c.oprname = '=';
 

INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy,        amopselect, amopnpages)SELECT am.oid, opcl.oid,
c.opoid,4,        'btreesel'::regproc, 'btreenpage'::regprocFROM pg_am am, pg_opclass opcl, glaccount_ops_tmp cWHERE
amname= 'btree' AND    opcname = 'glaccount_ops' AND    c.oprname = '>=';
 

INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy,        amopselect, amopnpages)SELECT am.oid, opcl.oid,
c.opoid,5,        'btreesel'::regproc, 'btreenpage'::regprocFROM pg_am am, pg_opclass opcl, glaccount_ops_tmp cWHERE
amname= 'btree' AND    opcname = 'glaccount_ops' AND    c.oprname = '>';
 


INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)SELECT a.oid, b.oid, c.oid, 1    FROM pg_am a, pg_opclass b,
pg_procc    WHERE a.amname = 'btree' AND        b.opcname = 'glaccount_ops' AND        c.proname = 'glaccount_cmp';
 

INSERT INTO pg_description (objoid, description)SELECT oid, 'Two part G/L account'    FROM pg_type WHERE typname =
'glaccount';

--
--    eof
--

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.


pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: [HACKERS] Broken select on regular expression !!!
Next
From: darcy@druid.net ("D'Arcy" "J.M." Cain)
Date:
Subject: Cache lookup failed