Todd Kover <kovert(at)omniscient(dot)com> writes:
> v_state[3] float8;
Hmm. I'm not sure what the plpgsql parser will make of that. I think
you probably wanted
v_state float8[3];
(note that you really want [4], not that it actually matters since PG
doesn't enforce the array size; float8[] would do as well)
Also, I think you need to change v_state to v_old_state in several more
places than you did, or else assign v_old_state to v_state up front.
regards, tom lane