Re: setof or array as input parameter to postgresql 8.2 functions - Mailing list pgsql-general

From Albe Laurenz
Subject Re: setof or array as input parameter to postgresql 8.2 functions
Date
Msg-id AFCCBB403D7E7A4581E48F20AF3E5DB2035BD920@EXADV1.host.magwien.gv.at
Whole thread Raw
In response to setof or array as input parameter to postgresql 8.2 functions  ("Jyoti Seth" <jyotiseth2001@gmail.com>)
List pgsql-general
> I have to pass a set of values and arrays in postgresql 8.2
> functions. But I am not getting any help on that. Please let
> me know if any one has idea.

Something like this?

CREATE OR REPLACE FUNCTION sample(avalue integer, anarray text[])
   RETURNS void LANGUAGE plpgsql STRICT AS
$$DECLARE
   i integer;
BEGIN
   -- I can access the value
   i := avalue;
   -- I can access the array
   i := anarray[2];
END;$$;

Called like

SELECT sample(3, ARRAY[1, 2, 3]);

Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: Johannes Konert
Date:
Subject: pg_xlog - files are guaranteed to be sequentialy named?
Next
From: Alvaro Herrera
Date:
Subject: Re: pg_xlog - files are guaranteed to be sequentialy named?