Problem with a PL/pgSQL function - Mailing list pgsql-sql

From Eric Prevost-Dansereau
Subject Problem with a PL/pgSQL function
Date
Msg-id 99110817441400.02118@eric.clg.qc.ca
Whole thread Raw
List pgsql-sql
I create that function:

CREATE FUNCTION livreEmprunte(int8) 
RETURNS varchar AS '
DECLARE  reponse varchar(200);  noDocu alias for $1;
BEGINSELECT CASE    WHEN dateremise > date(now()) then         varchar \'Emprunt� jusqu\'\'au \'||
substring(datetime_text(now())from 21 for 4)||         varchar \'-\'||substring(datetime_text(now()) from 5 for 3)||
   varchar \'-\'||substring(datetime_text(now()) from 9 for 2)||        varchar \' par \'||nomembre    WHEN dateremise
<date(now()) then         nomembre||        varchar \' devait le remettre le \'||
substring(datetime_text(now())from 21 for 4)||        varchar \'-\'||        substring(datetime_text(now()) from 5 for
3)||       varchar \'-\'||        substring(datetime_text(now()) from 9 for 2)    ELSE varchar \'Disponible\'END AS
disponibiliteINTOreponseFROM pretsWHERE montantpaye IS NULL AND nodoc = noDocu;IF NOT FOUND THEN
reponse:=\'Disponible\';ENDIF;RETURN reponse;
 
END;
' LANGUAGE 'plpgsql';

The function is created correctly, the PL/pgSQL language is installed correctly
and the select works when I execute it directly from psql prompt.

But when I call the function with: "SELECT livreEmprunte(1);", I receive:
ERROR:   fmgr_info: function 20288: cache lookup failed

I'm using RedHat Linux 6.0 wth PostgreSQL 6.5.2

What cause my problem?

Thank you.

�ric Pr�vost-Dansereau
e-mail: eric@esc.rosemere.qc.ca


pgsql-sql by date:

Previous
From: "Moray McConnachie"
Date:
Subject: Re: [SQL] parser :parse error
Next
From: Hiroshi Inoue
Date:
Subject: Re: [SQL] Move forward all (Was Re: How to get last 10 rows in a table on a large database?)