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

How to hand over array as variable in plpgsql function?

From: "Jan Peters" <petersjan(at)gmx(dot)at>
To: pgsql-sql(at)postgresql(dot)org
Subject: How to hand over array as variable in plpgsql function?
Date: 2008-10-27 16:25:37
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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 array but 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:

id_result integer;
b float4[];
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 ;

I know that there is a problem with the " '||b||' " part, so could someone point me in the right direction how to right this statement 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:


pgsql-sql by date

Next:From: Osvaldo KussamaDate: 2008-10-27 19:28:09
Subject: Fwd: grouping/clustering query
Previous:From: Tom LaneDate: 2008-10-27 12:15:20
Subject: Re: SQL Statement Missing From Log

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