PostgreSQL 8.4 will have a ROW_NUMBER() windowing function so this little hack will
hopefully be unnecessary when 8.4 is in production.
Getting back to this exercise, this was actually inspired by Hubert's recent article Tips N’ Tricks - setting field based on order. Why this inspired me, I guess because it stirred
up memories about the often forgotten utility of arrays in PostgreSQL and I thought it would answer a question that was haunting
me - How do I assign sequential numbers to a list?. The article just didn't quite read the way I expected it to and actually
was answering another question I cared much less about, but it did get the
juices flowing. So without much further ado.