pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stéphane FILLON <fillons@offratel.nc>
To: pgsql sql <pgsql-sql@postgresql.org>
To: pgsql admin <pgsql-admin@postgresql.org>
Subject: CHECK CONSTRAINT
Date: Sun, 1 Aug 1999 18:15:11 +1100
Message-ID: <000001bedbef$4429a840$c40a8280@portable> (raw)

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.




Message-ID: <000001bedbef$4429a840$c40a8280@portable>
Permalink:  ../000001bedbef$4429a840$c40a8280@portable/
Also on:    postgresql.org/message-id/000001bedbef$4429a840$c40a8280@portable

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: fillons@offratel.nc, pgsql-admin@postgresql.org
  Subject: Re: CHECK CONSTRAINT
  In-Reply-To: <000001bedbef$4429a840$c40a8280@portable>
  References: <000001bedbef$4429a840$c40a8280@portable>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox