Cache lookup failed

From: "D'Arcy" "J(dot)M(dot)" Cain <darcy(at)druid(dot)net>
To: hackers(at)PostgreSQL(dot)org
Subject: Cache lookup failed
Date: 1999-05-21 02:51:44
Message-ID: m10kfPU-0000bIC@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 opaque
as '/usr/local/pgsql/modules/glaccount.so'
language 'c';

create function glaccount_out(opaque)
returns opaque
as '/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 int
as '/usr/local/pgsql/modules/glaccount.so'
language 'c';

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

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

--
-- The various boolean tests:
--

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

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

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

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

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

create function glaccount_ge(glaccount, glaccount)
returns bool
as '/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.oprname
INTO TEMP TABLE glaccount_ops_tmp
FROM pg_operator o, pg_type t
WHERE 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'::regproc
FROM pg_am am, pg_opclass opcl, glaccount_ops_tmp c
WHERE 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'::regproc
FROM pg_am am, pg_opclass opcl, glaccount_ops_tmp c
WHERE 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'::regproc
FROM pg_am am, pg_opclass opcl, glaccount_ops_tmp c
WHERE 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'::regproc
FROM pg_am am, pg_opclass opcl, glaccount_ops_tmp c
WHERE 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'::regproc
FROM pg_am am, pg_opclass opcl, glaccount_ops_tmp c
WHERE 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_proc c
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(at){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.

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-05-21 03:19:22 Re: [HACKERS] Current TODO list
Previous Message Tatsuo Ishii 1999-05-21 01:57:14 Re: [HACKERS] Broken select on regular expression !!!