Michael Shapiro <mshapiro@ncsa.uiuc.edu> writes:
> I have tried the following (which doesn't work)
> dn[1] := \'a\';
> The parser doesn't like the [ that follows dn.
I believe Joe Conway fixed this in 7.4. Note that you also need to
initialize the array to something, because assigning to an element
of a NULL array still yields a NULL array result. For example:
regression=# create or replace function foo() returns text as '
regression'# declare dn text[] := \'{}\';
regression'# begin
regression'# dn[1] := \'a\';
regression'# return dn[1];
regression'# end' language plpgsql;
CREATE FUNCTION
regression=# select foo();foo
-----a
(1 row)
regards, tom lane