array_to_set functions

From: Decibel! <decibel(at)decibel(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: array_to_set functions
Date: 2007-08-01 01:04:59
Message-ID: 20070801010458.GE25704@nasby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)decibel(dot)org
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2007-08-01 01:44:50 Re: array_to_set functions
Previous Message Ralph Smith 2007-07-31 23:53:34 Re: Auto Starting +/or Shutdown on OS X