Search Postgresql Archives

Function with Integer array parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Postgres Gurus,
Please suggest me what is wrong with this function. This function tries to retrieve set of rows from description table based on set of ID fields passed as array.

The error, I get is : ERROR:  only one AS item needed for language "plpgsql"

CREATE OR REPLACE function get_description_list(integer[]) RETURNS SETOF type_description AS
'DECLARE
   ints_desc_ids ALIAS FOR $1;
       desc_rec __i18n.type_description%ROWTYPE;
BEGIN

   FOR desc_rec IN
       SELECT  d_base.id AS description_id,
          ''en'' AS iso_lang,
           ''US'' AS iso_country_a2,
           0 as description_type_id,
           d_base.description_text AS description_text
       FROM     description AS d_base
       WHERE   d_base.id in array_to_string(ints_desc_ids alias,',')
   LOOP
           RETURN NEXT desc_rec;
       END LOOP;
       RETURN;
 END;'
LANGUAGE plpgsql;


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux