Walter,
> CREATE FUNCTION update_cat_keys() RETURNS integer AS '
> declare
> v_row RECORD;
What's in-between v_row and RECORD? Maybe a non-standard tab character?
That's the only thing I can see, as the rest of your syntax looks fine.
(FYI, in PL/pgSQL, your function is not compiled until you run it.)
--
-Josh Berkus
Aglio Database Solutions
San Francisco