Are you sure about this? Try using RAISE NOTICE statements in the function to output the value of nnlength each time it's executed. Ray.
pgsql-general by date:
Соглашаюсь с условиями обработки персональных данных