v_vals TEXT[]; n_vals TEXT[];
try: v_vals TEXT[] := ''{}''; n_vals TEXT[] := ''{}'';
You have to initialize the array to something non-null, even if that be an empty array (note that there is a difference). When trying to append an element to a NULL valued array, you wind up with a NULL result. It is similar to:
regression=# select (NULL || 'abc') is null; ?column? ---------- t (1 row)
Joe
---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster