How to hand over array as variable in plpgsql function? - Mailing list pgsql-sql

From Jan Peters
Subject How to hand over array as variable in plpgsql function?
Date
Msg-id 20081027162537.66060@gmx.net
Whole thread Raw
Responses Re: How to hand over array as variable in plpgsql function?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Dear list,
I am trying to hand over an float4 array of a previous query in my plpgsql function. The query returns the correct
arraybut when I try to hand over this array to another function I get the error message:
 

ERROR: operator is not unique: "unknown" || real[]
SQL state: 42725
Hint: Could not choose a best candidate operator. You may need to add explicit type casts.
Context: PL/pgSQL function "get_matching_ids_sql_id" line 19 at execute statement. The function looks like this:

DECLARE
id_result integer;
b float4[];BEGIN
EXECUTE 'SELECT precip_control FROM precip_arrays WHERE  id = 400' INTO b;
[...]
EXECUTE 'SELECT id FROM precip_arrays WHERE  '||b||' = precip_control;' INTO id_result;
RETURN  id_result ;
END;

I know that there is a problem with the " '||b||' " part, so could someone point me in the right direction how to right
thisstatement correctly, so that the array can be processed by this SQL statement?
 

Thanks in advance and kind regards

Jan Peters-Anders

-- 
"Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
Jetzt GMX ProMail testen: http://www.gmx.net/de/go/promail


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: SQL Statement Missing From Log
Next
From: "Osvaldo Kussama"
Date:
Subject: Fwd: grouping/clustering query