Re: Accessing array elements in a FOR PL/pgsql loop

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Accessing array elements in a FOR PL/pgsql loop
Date: 2009-02-19 10:50:32
Message-ID: 20090219105032.GD8766@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In response to Igor Katson :
> I think I need a built-in function to make a column from an array, like
> in the backwards operation SELECT ARRAY(column)

By David Fetter:

CREATE OR REPLACE FUNCTION unnest(ANYARRAY) RETURNS SETOF ANYELEMENT
LANGUAGE SQL AS $$SELECT $1[i] FROM
generate_series(array_lower($1,1),array_upper($1,1)) i;$$;

HTH, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mike Christensen 2009-02-19 10:58:02 Re: When adding millions of rows at once, getting out of disk space errors
Previous Message Scott Marlowe 2009-02-19 10:41:04 Re: When adding millions of rows at once, getting out of disk space errors