Oh, there's another solution I forgot to mention: you could write the
nextval call as
nextval('s'::text)
which would force a runtime lookup of 's' on each call. On the whole
though, numbering the rows yourself with a local counter is going to
run a lot faster.
regards, tom lane