array_to_set functions - Mailing list pgsql-general

From Decibel!
Subject array_to_set functions
Date
Msg-id 20070801010458.GE25704@nasby.net
Whole thread Raw
Responses Re: array_to_set functions  ("Merlin Moncure" <mmoncure@gmail.com>)
List pgsql-general
David Fetter and I just came up with these, perhaps others will find
them useful:

CREATE OR REPLACE FUNCTION array_to_set(anyarray, int) RETURNS SETOF anyelement LANGUAGE SQL AS $$
    SELECT $1[i] from generate_series(array_lower($1, $2), array_upper($1, $2)) i
$$;
CREATE OR REPLACE FUNCTION array_to_set(anyarray) RETURNS SETOF anyelement LANGUAGE SQL AS $$
    SELECT array_to_set($1, 1)
$$;
--
Decibel!, aka Jim Nasby                        decibel@decibel.org
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)

Attachment

pgsql-general by date:

Previous
From: Ralph Smith
Date:
Subject: Re: Auto Starting +/or Shutdown on OS X
Next
From: "Merlin Moncure"
Date:
Subject: Re: array_to_set functions