On 16th of February, Tom Lane committed patch: Add FOREACH IN ARRAY looping to plpgsql.   (I'm not entirely sure that we've finished bikeshedding the syntax details, but the functionality seems OK.)   Pavel Stehule, reviewed by Stephen Frost and Tom Lane

Let's imagine simple situation - you have table of objects (each with id), and you want objects 3, 71, 5 and 16. And in that order! How to do it?

Finally, we got very important addons to PostgreSQL, which help with dealing with arrays. It solves a lot of problems, which were usually solved with standard cookbook code, which was in faqs, blog posts and number of examples on irc.