pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Eric Prevost-Dansereau <prevoste@saturne.clg.qc.ca>
To: pgsql-sql@postgresql.org
Subject: Problem with a PL/pgSQL function
Date: Mon, 8 Nov 1999 17:38:50 -0500
Message-ID: <99110817441400.02118@eric.clg.qc.ca> (raw)

I create that function:

CREATE FUNCTION livreEmprunte(int8) 
RETURNS varchar AS '
DECLARE
   reponse varchar(200);
   noDocu alias for $1;
BEGIN
	SELECT 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 disponibilite
	INTO reponse
	FROM prets
	WHERE montantpaye IS NULL AND nodoc = noDocu;
	
	IF NOT FOUND THEN
		reponse:=\'Disponible\';
	END IF;
	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



Message-ID: <99110817441400.02118@eric.clg.qc.ca>
Permalink:  ../99110817441400.02118@eric.clg.qc.ca/
Also on:    postgresql.org/message-id/99110817441400.02118@eric.clg.qc.ca

 · 

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: prevoste@saturne.clg.qc.ca
  Subject: Re: Problem with a PL/pgSQL function
  In-Reply-To: <99110817441400.02118@eric.clg.qc.ca>
  References: <99110817441400.02118@eric.clg.qc.ca>

* 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