"Claus Guttesen" <[EMAIL PROTECTED]> writes: > create or replace function update_hashcode() returns setof duplicates as > $body$ > declare > d duplicates%rowtype; > h text; > begin > for d in select * from duplicates where length(hashcode) = 33 loop > h := rtrim(d.hashcode, E'\n'); > update duplicates set hashcode = h where id = d.id; > return next d; > end loop; > end > $body$ > language 'plpgsql' ;
Why in the world are you using a for-loop for this at all? It would be tremendously faster as a single SQL command: update duplicates set hashcode = rtrim(hashcode, E'\n') where length(hashcode) = 33; regards, tom lane -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql