Array_append does not work with Array variables in PL/pgSQL? - Mailing list pgsql-sql

From Josh Berkus
Subject Array_append does not work with Array variables in PL/pgSQL?
Date
Msg-id 200404011320.37766.josh@agliodbs.com
Whole thread Raw
Responses Re: Array_append does not work with Array variables in PL/pgSQL?  (Joe Conway <mail@joeconway.com>)
List 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 BerkusAglio Database SolutionsSan Francisco



pgsql-sql by date:

Previous
From: "Olivier Hubaut"
Date:
Subject: Re: Is it normal that functions are so much faster than inline queries
Next
From: Joe Conway
Date:
Subject: Re: Array_append does not work with Array variables in PL/pgSQL?