Array_append does not work with Array variables in PL/pgSQL?

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Cc: mail(at)joeconway(dot)com
Subject: Array_append does not work with Array variables in PL/pgSQL?
Date: 2004-04-01 21:20:37
Message-ID: 200404011320.37766.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Folks,

See if you can spot any mistake I'm making here. I've declared the following
array variables in a plpgsql function:

v_vals TEXT[];
n_vals TEXT[];

After some manipulation, I try to synch them:

n_vals := array_append(n_vals, v_vals[arrloop]);
val_result := v_vals[arrloop];
RAISE NOTICE ''orig value %'', val_result;
val_result := array_to_string(n_vals, '', '');
RAISE NOTICE ''derived value %'', val_result;

And I get:

NOTICE: orig value 04/01/2004
NOTICE: derived value <NULL>
NOTICE: orig value 04/01/2004
NOTICE: derived value <NULL>

It seems like I cannot assign new elements to arrays inside a PL/pgsql
function. What gives here?

PostgreSQL 7.4.1 on Linux.

--
-Josh Berkus
Aglio Database Solutions
San Francisco

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Joe Conway 2004-04-01 21:36:45 Re: Array_append does not work with Array variables in PL/pgSQL?
Previous Message abhi 2004-04-01 16:05:55 Getting the ranks of results from a query