Bonjour, j'ai une function sur une Postgresql 8.0 qui fonctionne nikel,

je veux faire un dump vers une base 7.4 et là j'ai un problème que je n'arrive pas à régler avec pgadmin3.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
-- Function: insertupdate(int4, date, int4, int4)
 
-- DROP FUNCTION insertupdate(int4, date, int4, int4);
 
CREATE OR REPLACE FUNCTION insertupdate(int4, date, int4, int4)
  RETURNS bool AS
$BODY$
DECLARE
heure ALIAS FOR $1;
jour ALIAS FOR $2;
formateur ALIAS FOR $3;
participant ALIAS FOR $4;
trouve record;
 
BEGIN
 SELECT INTO trouve * FROM registre
  WHERE regjour=jour
  AND idlogin = formateur
  AND idparticipant = participant;
IF NOT FOUND THEN
 INSERT INTO registre (regheure,regjour,idlogin,idparticipant)
 VALUES (heure,jour,formateur,participant);
 RETURN 't';
 
ELSE
 UPDATE registre SET regheure=heure
  WHERE regjour=jour
  AND idlogin = formateur
  AND idparticipant = participant; 
  RETURN 'f';
END IF;
RETURN 't';
END;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION insertupdate(int4, date, int4, int4) OWNER TO postgres;
je n'ai plus en tête comment écrire correctement cette function, apparement le problème se situe au niveau du body.

Merci de votre aide