Received: from mail.offratel.nc (FS25.offratel.nc [209.58.55.25]) by hub.org (8.9.3/8.9.3) with ESMTP id DAA52033; Sun, 1 Aug 1999 03:27:49 -0400 (EDT) (envelope-from fillons@offratel.nc) Received: from portable (unverified [202.22.159.117]) by mail.offratel.nc (Rockliffe SMTPRA 3.3.1) with SMTP id ; Sun, 1 Aug 1999 18:28:16 +1100 Message-ID: <000001bedbef$4429a840$c40a8280@portable> Reply-To: "=?iso-8859-1?Q?St=E9phane_FILLON?=" From: "=?iso-8859-1?Q?St=E9phane_FILLON?=" To: "pgsql sql" , "pgsql admin" Subject: CHECK CONSTRAINT Date: Sun, 1 Aug 1999 18:15:11 +1100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 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.