Bonjour,

J'utilise postgresql "PostgreSQL 9.0.4, compiled by Visual C++ build 1500, 32-bit" sous windows et je veux insérer les données de ma table t1 vers une autre table t2 dans une base postgres 8.3 "PostgreSQL 8.3.11 on i486-pc-linux-gnu, compiled by GCC gcc-4.3.real (Debian 4.3.2-1.1) 4.3.2" sous linux.

Pour ce faire , j'ai écrit une fonction :

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
 
CREATE OR REPLACE FUNCTION f_affiche ()
RETURNS VOID
AS $$
DECLARE
    c1 cursor IS SELECT * FROM eth0;
    eth0_row eth0%ROWTYPE;
BEGIN
 
    FOR eth0_row IN c1
    LOOP
     PERFORM dblink_exec('dbname=suivBP host=10.128.1.2', 'INSERT INTO eth0 (rx,tx,datecurrent,heurecurrent) VALUES (' || eth0_row.rx || ', ' || eth0_row.tx || ', ' || eth0_row.datecurrent || ', ' || eth0_row.heurecurrent || ')');
    END LOOP;
    RETURN;
END
 
$$ LANGUAGE PLPGSQL


J'ai l'erreur suivante quand je lance ma fonction


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
 
ERREUR:  la fonction dblink_exec(unknown, text) n'existe pas
LINE 1: SELECT dblink_exec('dbname=suivBP host=10.128.1.2', 'INSERT ...
               ^
HINT:  Aucune fonction ne correspond au nom donné et aux types d'arguments.
Vous devez ajouter des conversions explicites de type.
QUERY:  SELECT dblink_exec('dbname=suivBP host=10.128.1.2', 'INSERT INTO eth0 (rx,tx,datecurrent,heurecurrent) VALUES (' || eth0_row.rx || ', ' || eth0_row.tx || ', ' || eth0_row.datecurrent || ', ' || eth0_row.heurecurrent || ')')
CONTEXT:  PL/pgSQL function "f_affiche" line 8 at PERFORM
 
********** Erreur **********
 
ERREUR: la fonction dblink_exec(unknown, text) n'existe pas
État SQL :42883
Astuce : Aucune fonction ne correspond au nom donné et aux types d'arguments.
Vous devez ajouter des conversions explicites de type.
Contexte : PL/pgSQL function "f_affiche" line 8 at PERFORM

Est-ce que c'est lié aux versions des deux bases ?
Si oui, est-que vous avez des idées ?