pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Greg Johnson <gregj@interprose.com>
To: Josh Berkus <josh@agliodbs.com>
To: pgsql-sql@postgresql.org
Subject: Re: Passing array to PL/SQL and looping
Date: Fri, 27 Sep 2002 09:04:58 -0700
Message-ID: <web-1731886@davinci.ethosmedia.com> (raw)
In-Reply-To: <1033140741.4254.12.camel@watto.interprose.net>

Greg,

> CREATE FUNCTION test_array( ) RETURNS VARCHAR[] AS '
> DECLARE 
>     return_array VARCHAR[];
> BEGIN
>     return_array[0] := ''test'';
>     return_array[1] := ''test 1'';
>     return_array[2] := ''test 2'';
> RETURN (return_array);
> END;'
> LANGUAGE 'plpgsql';

No, it's not possible to do the above.   This is a flaw in the current
implementation of PL/pgSQL that will not be resolved until we attract
some new Postgres hackers who really care about upgrading PL/pgSQL.

Currently, if you want to use an array, it has to be passed as a
parameter, or come from an external table.   You cannot declare an
Array data type.  Annoying, really.

-Josh Berkus



view thread (9+ messages)  latest in thread

Message-ID: <web-1731886@davinci.ethosmedia.com>
Permalink:  ../web-1731886@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-1731886@davinci.ethosmedia.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, gregj@interprose.com
  Subject: Re: Passing array to PL/SQL and looping
  In-Reply-To: <web-1731886@davinci.ethosmedia.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox