Skip site navigation (1) Skip section navigation (2)

Re: Plsql et dblink

From: Tovo Rabemanantsoa <tovo(at)bordeaux(dot)inra(dot)fr>
To: Pgsql Fr Generale <pgsql-fr-generale(at)postgresql(dot)org>
Subject: Re: Plsql et dblink
Date: 2008-07-23 14:22:32
Message-ID: 48873EA8.8010905@bordeaux.inra.fr (view raw or flat)
Thread:
Lists: pgsql-fr-generale
Guillaume Lelarge wrote:
> Tovo Rabemanantsoa a écrit :
>> [...]
>> CREATE OR REPLACE FUNCTION populate_flux()
>>   RETURNS numeric AS
>> $BODY$
>> declare
>>     tuples record;
>> begin
>>     FOR tuples IN SELECT toto FROM dblink('dbname=Base1', 'SELECT * 
>> FROM Flux1') as (toto record)
>>     LOOP
>>         RAISE NOTICE 'H2O = % et CO2 = % : %',tuples."H2O", tuples."CO2";
>>
>>     END LOOP;
>>     return 0;
>> end;
>> $BODY$
>>   LANGUAGE 'plpgsql' VOLATILE;
>>
>> Et bien entendu, ça, ça ne marche pas.
> 
> C'est-à-dire ? en quoi cela ne fonctionne pas ? avez-vous un message 
> d'erreur ?
> 
>> Visiblement la partie "FOR tuples IN SELECT toto FROM 
>> dblink('dbname=Base1', 'SELECT * FROM Flux1') as (toto record)" n'est 
>> pas bon.
>> Est-ce que quelqu'un pourrait me dire comment faire dans ce cas ?
>> Merci d'avance.
>>
> 
> 
Oui, pardon, j'ai oublié de poster le message d'erreur :

ERROR:  column "toto" has pseudo-type record
CONTEXT:  SQL statement " SELECT toto FROM dblink('dbname=Base1', 'SELECT * FROM Flux1') as (toto record)"
PL/pgSQL function "populate_flux" line 4 at for over select rows

********** Erreur **********

ERROR: column "toto" has pseudo-type record
État SQL :42P16
Contexte : SQL statement " SELECT toto FROM dblink('dbname=Base1', 'SELECT * FROM Flux1') as (toto record)"
PL/pgSQL function "populate_flux" line 4 at for over select rows

-- 
Tovo J. RABEMANANTSOA
INRA - UR1263 EPHYSE
71, Av. Edouard Bourlaux
F-33140 Villenave d'Ornon - France
Téléphone : +33 5 57 12 24 09


In response to

Responses

pgsql-fr-generale by date

Next:From: Daniel VeriteDate: 2008-07-23 15:05:02
Subject: Re: Plsql et dblink
Previous:From: Guillaume LelargeDate: 2008-07-23 13:47:33
Subject: Re: Plsql et dblink

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group