Function xxxx() does no exist
От | Philippe Lefèvre |
---|---|
Тема | Function xxxx() does no exist |
Дата | |
Msg-id | 38F62DAE.3B8BBBE0@libertysurf.fr обсуждение исходный текст |
Ответы |
Re: Function xxxx() does no exist
|
Список | pgsql-sql |
I've already sent this request for help to the novice mail list but I <br />never get any answer. So I wonder if it wasthe good list for that kind <br />of question and I'm publishing it here. <br />(thousand of apologies if I'm wrong !)<p>I'm a beginner with postgres and I'm trying to understand how I can <br />workaround the FOREIGN KEY mechanism withinPostgres. <p>I've read that it's not supported yet (before rel 7) and I can use a trigger but I have some trouble witha Function. <p>So I created: <br />CREATE TABLE "tbl_article" ( <br /> "i_article" serial PRIMARY KEY, <br /> "repere"text, <br /> "refmedia" int4 NOT NULL, <br /> "theme" int4 NOT NULL, <br /> "mot_cle1" int4 NOT NULL, <br /> "mot_cle2" int4, <br /> "mot_cle3" int4); <p>and: <br /> CREATE TABLE "tbl_theme" ( <br /> "i_theme" serial PRIMARYKEY, <br /> "theme" text NOT NULL UNIQUE); <p>then: <br /> CREATE FUNCTION chk_itheme_proc(int4) RETURNS int4<br /> AS 'SELECT COUNT(i_theme) FROM tbl_theme <br /> WHERE i_theme = $1;' <br /> LANGUAGE 'sql'; <p>and Icreated a trigger: <br /> CREATE TRIGGER chk_itheme_trig BEFORE INSERT OR UPDATE ON tbl_article <br /> FOR EACH ROW EXECUTEPROCEDURE chk_itheme_proc ('theme'); <p>but I get the message: <br /> ERROR: CreateTrigger: function chk_itheme_proc()does not exist <p>If I do: <br />SELECT theme FROM tbl_article <br /> WHERE chk_itheme_proc(5) = 1; --i_theme goes from 1 to 12 <p>theme <br />----- <br /> 11 <br />(1 row) <p>If I do now: <br />SELECT theme FROM tbl_article<br /> WHERE chk_itheme_proc(15) = 1; <br />theme <br />----- <br />(0 row) <p>So I can see that the functionis available .... <p>I'm stuck with this issue and I wasn't able to find any help on <br />documentations. <p>Isthere somebody who could help me ??? <p>Many thanks in advance, <br />PhiL <pre>-- ============================================================================== * PhiL is using a Linux Kernel 2.2.14 * ==============================================================================</pre>
В списке pgsql-sql по дате отправления: