CHECK CONSTRAINT

From: Stéphane FILLON <fillons(at)offratel(dot)nc>
To: "pgsql sql" <pgsql-sql(at)postgresql(dot)org>, "pgsql admin" <pgsql-admin(at)postgresql(dot)org>
Subject: CHECK CONSTRAINT
Date: 1999-08-01 07:15:11
Message-ID: 000001bedbef$4429a840$c40a8280@portable
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have 2 tables ART and MTF as follow:

create table art(
artid int4 primary key,
mtfid int4, -- can be null or foreign key with MTF

constraint ck_mtfid check(mtfid is null or fk_mtfid(mtfid))
);

create table mtf(
mtfid int4 primary key
);

create function fk_mtfid(int4) returns bool as '
declare
result int4;

begin
select mtfid into result from mtf where mtfid = $1;

if found then
return true;
else
return false;
end if;
end;
' language 'plpgsql';

The function works fine when I run it at the psql prompt, but when I tried
to insert some tuple in ART I have the following error:

"ERROR: init_fcache: Cache lookup failed for procedure 273568"

Best Regards,

Stephane.

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-08-01 14:55:30 Re: [SQL] MVCC and concurrent clients
Previous Message Stéphane FILLON 1999-08-01 05:31:38 DOMAIN DEFINITION